Dockerfile
From base Mirror
Maintainer maintain this information
What command runs run, plus run in front of the command
Add to add some files, copy files, will automatically extract
Workdir the current working directory
VOLUME Directory Mount
Expose Open ports
The run process has to be running
Combat: Building Nginx
wget http://xiazai.jb51.net/201611/yuanma/nginx-1.9.3 (jb51.net). rar
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
#This is my dockerfile#version 1.0
#Author: hh
#Base Image base mirroring from
CentOS
#MAINTAINER maintainer information
Maintainer hh Wang
#ADD
ADD pcre-8.38.tar.gz/usr/local/srcadd nginx-1.9.3.tar.gz/usr/local/src
#RUN
RUN yum-y Install wget gcc gcc-c++ make OpenSSL openssl-devel
Run useradd-s/sbin/nologin-m www
#WORKDIR
workdir/usr/local/src/nginx-1.9.3
run./configure-- Prefix=/usr/local/nginx--user=www--group=www--with-http_ssl_module--with-http_stub_status_module
with-pcre=/usr/local/src/pcre-8.38 && make && make install
RUN echo ' daemon off; ' >>/usr/local/nginx/conf/nginx.conf
#ENV定义环境变量
ENV path/usr/local/nginx/sbin: $PATH
#EXPOSE Map port
expose CMD ["Nginx"]
Docker build-t Whh/nginx-file:v1.
Docker run-d-it-p 93:80--name nginx
Now look at the use of Dockerfile
Mirroring can be established by using the Docker build command.
Text file Dockerfile is usually required, as in the following example:
From Hub.c.163.com/library/nginx----based mirroring
Run echo "Hello World" >/etc/nginx/index.xml----append to the end of index.html
Expose---exposed 80 ports
Cmd ' nginx '----start Nginx service
After saving, run Docker build-t mynginx:1.0.
Then run Docker images and look at the mirrors that were built.
Via Docker run-d-P 8082:80--name nginx_web mynginx:1.0
Finally, access to Nginx's index.html content via http://ip:8081