Use dockerfile to create nginx docker

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.