Download the required package wget http://nginx.org/download/nginx-1.14.0.tar.gz in the nginx directory
Wget https://ftp.pcre.org/pub/pcre/pcre2-10.23.tar.gz -- no-check-Certificate
The following is the meaning of the dockerfile command:
From inherited from
Maintainer
What is run?
Add to add a vertex File
Current workdir working directory
Mount the volume directory
Port opened by expose
Run
Create dockerfile
VI dockerfile
Content:
# This is my first dockerfile
# Version 1.0
# Author: shejiewei
From centos
Maintainer shejiwei
Add nginx-1.14.0.tar.gz/usr/local/src
Add pcre2-10.23.tar.gz/usr/local/src
Run Yum install-y wget GCC gcc-C ++ make OpenSSL-devel
Run useradd-S/sbin/nologin-M WWW
Workdir/usr/local/src/nginx-1.14.0
Run. /configure -- prefix =/usr/local/nginx -- user = WWW -- group = WWW -- with-http_ssl_module -- with-http_stub_status_module -- With-PCRE =/usr/local/src/pcre2-10.23 & make & & make install
Run echo "daemon off;">/usr/local/nginx/CONF/nginx. conf
Env path/usr/local/nginx/sbin: $ path
Expose 80
CMD ["nginx"]
Then execute:
Docker build-T nginx-file: V1/data/docker-file/nginx start building
Use dockerfile to create nginx docker