Notice: Constant WP_DEBUG already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 12

Notice: Constant WP_DEBUG_LOG already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 13

Notice: Constant WP_DEBUG_DISPLAY already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 14
Dockerfile【zoues.com】 – zoues

LOADING

Follow me

Dockerfile【zoues.com】
六月 11, 2017|DockerPaaS

Dockerfile【zoues.com】

Dockerfile【zoues.com】

Dockerfile
 

############################################################
# Dockerfile to build Nginx Installed Containers
# Based on CentOS
############################################################
# Set the base image to CentOS
FROM centos
# File Author / Maintainer
MAINTAINER alex
# Install necessary tools
RUN yum install -y pcre-devel wget net-tools gcc
RUN yum install -y zlib zlib-devel make
RUN yum install -y openssl-devel
# Install Nginx
ADD http://nginx.org/download/nginx-1.8.0.tar.gz .
RUN tar zxvf nginx-1.8.0.tar.gz
RUN mkdir -p /usr/local/nginx
RUN cd nginx-1.8.0 && ./configure --prefix=/usr/local/nginx && make && make install
RUN rm -fv /usr/local/nginx/conf/nginx.conf
COPY .nginx_conf /usr/local/nginx/conf/nginx.conf
# Expose ports
EXPOSE 80
# Set the default command to execute
# when creating a new container
CMD /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
创建镜像
 

# docker build -t centos_nginx .
Sending build context to Docker daemon   554 MB
Sending build context to Docker daemon 
Step 0 : FROM centos
 ---> bac949ce964b
Step 1 : MAINTAINER aming aming@aminglinux.com
 ---> Using cache
 ---> c2065048b72a
Step 2 : RUN yum install -y pcre-devel wget net-tools gcc
 ---> Using cache
 ---> 05fa4cc1856f
Step 3 : RUN yum install -y zlib zlib-devel make
 ---> Using cache
 ---> 99960731c759
Step 4 : RUN yum install -y openssl-devel
 ---> Using cache
 ---> 1f3cc9ae48cd
Step 5 : ADD http://nginx.org/download/nginx-1.8.0.tar.gz .
Downloading 832.1 kB/832.1 kB
 ---> Using cache
 ---> 16d6f68fea77
Step 6 : RUN tar zxvf nginx-1.8.0.tar.gz
 ---> Using cache
 ---> 4df46e512943
Step 7 : RUN mkdir -p /usr/local/nginx
 ---> Using cache
 ---> 865f9d97d9e5
Step 8 : RUN cd nginx-1.8.0 && ./configure --prefix=/usr/local/nginx && make && make install
 ---> Using cache
 ---> b997c1dce057
Step 9 : RUN rm -fv /usr/local/nginx/conf/nginx.conf
 ---> Using cache
 ---> 857e27129832
Step 10 : COPY .nginx_conf /usr/local/nginx/conf/nginx.conf
 ---> 3a300ffbcfa3
Removing intermediate container bc3bdb68a3c2
Step 11 : EXPOSE 80
 ---> Running in 6a8c267e92b6
 ---> 20c46a5b0b57
Removing intermediate container 6a8c267e92b6
Step 12 : CMD /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 ---> Running in 0b626e465eaa
 ---> 54caaabd2c3b
Removing intermediate container 0b626e465eaa
Successfully built 54caaabd2c3b
启动

docker run -itd -P centos_nginx bash

docker exec -it 398a bash

398a6248bb74        centos_nginx        "bash"              4 minutes ago       Up 4 minutes                   0.0.0.0:32768->80/tcp   agitated_banach          

 
# curl 127.0.0.1:32768
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>

Dockerfile

no comments
Share