使用Dockerfile创建nginx服务容器镜像
2016-12-26 18:50
1166 查看
1.下载nginx配置文件 wget http://www.apelearn.com/study_v2/.nginx_conf
2. vim Dockerfile
#本地有centos的镜像,可以直接指定镜像名称;如果需要从docker官网下载其他版本镜像,请自行修改版本号
FROM centos:6.8
MAINTAINER wyman wyman@xxx.com
#根据实际需要选择安装
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. 创建镜像文件
docker build -t centos_nginx . 其中 . 代表Dockerfile 所在的文件的路径
2. vim Dockerfile
#本地有centos的镜像,可以直接指定镜像名称;如果需要从docker官网下载其他版本镜像,请自行修改版本号
FROM centos:6.8
MAINTAINER wyman wyman@xxx.com
#根据实际需要选择安装
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. 创建镜像文件
docker build -t centos_nginx . 其中 . 代表Dockerfile 所在的文件的路径
相关文章推荐
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- 【系列3】使用Dockerfile创建带编译安装nginx服务的Centos Docker镜像
- 使用Dockerfile创建支持ssh服务自启动的容器镜像
- 【Dockerfile】使用Dockerfile创建带nginx服务的Centos Docker镜像
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- 【系列3】使用Dockerfile创建yum安装nginx服务的Centos Docker镜像
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- Docker实战:使用Dockerfile创建带nginx服务并支持ssh的Centos Docker镜像
- Docker使用Dockerfile创建支持ssh服务自启动的容器镜像
- docker学习笔记3—使用Dockerfile与docker build命令创建一个nginx服务器镜像,并使用浏览器进行访问
- 使用Dockerfile构建支持ssh服务自启动的容器镜像
- 「二」创建一个带 ssh 服务的基础镜像(修订版)--使用 Dockerfile 创建
- Dockerfile创建带有nginx服务的Centos Docker镜像
- 使用Dockerfile创建一个带 ssh 服务的基础镜像
- docker 安装 创建支持ssh服务的镜像 创建nginx服务的镜像 用dockerfile制作nginx镜像
- 【Dockerfile】使用Dockerfile创建带Apache服务的Centos Docker镜像
- 通过Dockerfile创建nginx服务的Centos镜像
- 使用docker 拉取镜像和创建容器-nginx