dockerfile
Posted 大贤smd
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dockerfile相关的知识,希望对你有一定的参考价值。
FROM hub.c.163.com/library/centos
MAINTAINER Victor [email protected]
RUN yum clean all
RUN yum -y install gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel
ADD nginx-1.8.0.tar.gz .
RUN useradd nginx
RUN cd /nginx-1.8.0 && ./configure --prefix=/usr/local/nginx && make && make install
RUN chown -R nginx:nginx /usr/local/nginx
EXPOSE 80
docker build -t nginx01:01 .
FROM hub.c.163.com/library/centos
MAINTAINER Victor [email protected]
ADD jdk-8u20-linux-x64.rpm .
ADD apache-tomcat-7.0.47.tar.gz .
RUN rpm -ivh jdk-8u20-linux-x64.rpm
RUN mv apache-tomcat-7.0.47 /opt/tomcat
docker build -t tomcat01:01 .
docker run -ti -d --name nginx1 -p 80:80 nginx01:01 /bin/bash
docker exec -ti 32da5e52f8e8 /bin/bash
/usr/local/nginx/sbin/nginx
-----------------------------------------------------------------------------------------------------
docker run -ti -d -p 1234:8080 --name tomcat1 -v /www:/opt/tomcat/webapps tomcat01:01 /bin/bash |
[[email protected] www]# ls
upload upload.zip
[[email protected] www]# chmod -R 777 ../www
[[email protected] www]# ll
总用量 18328
drwxrwxrwx. 14 root root 4096 12月 14 2014 upload
-rwxrwxrwx. 1 root root 18761018 3月 2 10:20 upload.zip
[[email protected] www]# rm -rf upload.zip
[[email protected] www]# ll
[[email protected] /]# /opt/tomcat/bin/shutdown.sh |
[[email protected] /]# /opt/tomcat/bin/startup.sh
http://192.168.232.129:32323/upload/install/ 测试安装
|
-------------------------------------------------------------------------------------------------------------
docker run -ti -P -d --name mysql hub.c.163.com/library/mysql /bin/bash
docker exec -ti de35832c5c51 /bin/bash
/etc/init.d/mysql start
mysql> create database discuz;
mysql> grant all on *.* to [email protected]‘%‘ identified by ‘123‘;
mysql> flush privileges;
负载均衡
[[email protected] /]# vi /usr/local/nginx/conf/nginx.conf
location / {
proxy_pass http://daxian;
}
upstream daxian {
server 192.168.232.129:32323;
server 192.168.232.129:32370;
}
}
[[email protected] /]# pkill nginx
[[email protected] /]# /usr/local/nginx/sbin/nginx
ip/upload/install flush
tomcat : log
tail -f /opt/tomcat/logs/localhost_access_log.2016-12-30.txt
以上是关于dockerfile的主要内容,如果未能解决你的问题,请参考以下文章