首页 > 代码库 > dockerfile
dockerfile
FROM hub.c.163.com/library/centos
MAINTAINER Victor 18202241253@163.com
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 18202241253@163.com
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 |
[root@localhost www]# ls
upload upload.zip
[root@localhost www]# chmod -R 777 ../www
[root@localhost www]# ll
总用量 18328
drwxrwxrwx. 14 root root 4096 12月 14 2014 upload
-rwxrwxrwx. 1 root root 18761018 3月 2 10:20 upload.zip
[root@localhost www]# rm -rf upload.zip
[root@localhost www]# ll
[root@1fc1735cabdb /]# /opt/tomcat/bin/shutdown.sh |
[root@1fc1735cabdb /]# /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 discuz@‘%‘ identified by ‘123‘;
mysql> flush privileges;
负载均衡
[root@32da5e52f8e8 /]# 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;
}
}
[root@32da5e52f8e8 /]# pkill nginx
[root@32da5e52f8e8 /]# /usr/local/nginx/sbin/nginx
ip/upload/install flush
tomcat : log
tail -f /opt/tomcat/logs/localhost_access_log.2016-12-30.txt
dockerfile