安装Nginx的Dockerfile实例
Posted fansik
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装Nginx的Dockerfile实例相关的知识,希望对你有一定的参考价值。
################################################
#Dockerfile to build nginx Installed Containers#
#Based on CentOS #
################################################
#Set the base image to CentOS
FROM centos
#File Author / Maintainer
MAINTAINER fansik [email protected]
#Install necessary tools
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
#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
RUN cd 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
#Expose ports
EXPOSE 80
#Set the default command to execute
#when creating a new container
#CMD /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
以上是关于安装Nginx的Dockerfile实例的主要内容,如果未能解决你的问题,请参考以下文章
Docker中Dockerfile的格式Dockerfile安装nginx实例
docker--学习笔记最后附dockerfile--nginx实例
10.Docker-----安装初步使用镜像Dockerfile常用指令通过Dockerfile文件封装nginx镜像并优化
在linux下安装nginx时报出./configure: error: invalid option "–prefix=/usr/webserver/ngi