Dockerfile Combat (i): Customize a simple Nginx service

Source: Internet
Author: User
Tags docker ps docker run

The first step is to download the nginx image

Docker Pull Nginx

Step two, partially modified

#This is a nginx dockerfile


#Source image

From Nginx


#Author

Maintainer Leonlong from dockerpool.conf [email protected]


#mount Point

Volume/opt/nginx/conf

Volume/var/log/nginx

Volume/opt/nginx/www


#Run Instructions

RUN echo "Asia/shanghai" >/etc/timezone && dpkg-reconfigure-f noninteractive tzdata

CMDnginx-g "daemon off;"

Note: The cmd instructions are all processes that start in non-daemon mode, and if you do not turn off daemon mode, you can see through Docker PS that the container's start will only be run once and end

The third step is to build your own image

cd/opt/docker/dockerfiles/nginx/;d ocker build-t nginx:private.

Fourth step, start

Create the relevant directory and launch the Docker container Nginx

Docker run-it-p 80:80-p 443:443-v/opt/docker/mounts/nginx/log:/var/log/nginx-v/opt/docker/mounts/nginx/conf:/opt/ Nginx/conf-v/opt/docker/mounts/nginx/www:/opt/nginx/www--name nginxtest nginx:private

This article is from the "Letter" blog, please be sure to keep this source http://leon0long.blog.51cto.com/3011404/1812330

Dockerfile Combat (i): Customize a simple Nginx service

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.