Creating an Nginx service container image using Dockerfile

Source: Internet
Author: User

1. Download Nginx configuration file wget http://www.apelearn.com/study_v2/.nginx_conf

2. Vim Dockerfile

#本地有centos的镜像, you can specify the image name directly, and if you need to download another version of the image from the Docker website, modify the version number yourself

From centos:6.8

Maintainer Wyman [email protected]

#根据实际需要选择安装

RUN Yum install-y pcre-devel wget net-tools gcc zlib zlib-devel make Openssl-devel tar

ADD Http://nginx.org/download/nginx-1.8.0.tar.gz/root

RUN Tar zxf/root/nginx-1.8.0.tar.gz

RUN mkdir-p/usr/local/nginx

RUN cd/root/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

RUN RM-FV nginx-1.8.0.tar.gz

EXPOSE 80

3. Create an image file

Docker build-t Centos_nginx. which. Represents the path to the file where the Dockerfile resides


Creating an Nginx service container image using Dockerfile

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.