码迷,mamicode.com
首页 > 其他好文 > 详细

Dockerfile示例-nginx

时间:2016-06-12 15:37:49      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:necessary   配置文件   

l先下载nginx的配置文件 wget http://www.apelearn.com/study_v2/.nginx_conf

lvim Dockerfile //内容如下

############################################################
# Dockerfile to build Nginx Installed Containers
# Based on CentOS
############################################################
# Set the base image to CentOS
FROM centos
# File Author / Maintainer
MAINTAINER aming aming@aminglinux.com

# Install necessary tools
RUN yum install -y pcre-devel wget net-tools gcc
RUN yum install -y zlib zlib-devel make

RUN yum install -y openssl-devel

l# Install Nginx
ADD http://nginx.org/download/nginx-1.8.0.tar.gz .
RUN tar zxvf nginx-1.8.0.tar.gz
RUN mkdir -p /usr/local/nginx

lRUN cd nginx-1.8.0.tar.gz && ./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

# Expose ports
EXPOSE 80
# Set the default command to execute
# when creating a new container
ENTRYPOINT /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

l创建镜像:

ldocker build -t centos_nginx  .

ldocker  images 可以看到我们新建的镜像


Dockerfile示例-nginx

标签:necessary   配置文件   

原文地址:http://xiongrunchu.blog.51cto.com/11696174/1788201

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!