Dockerfile(七)安装nginx

Dockerfile安装nginx

写一个Dockerfile文件

FROM centos
MAINTAINER apeng [email protected]
RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
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 -j 4 && make -j 4  install
RUN rm -fv /usr/local/nginx/conf/nginx.conf
ADD http://www.apelearn.com/study_v2/.nginx_conf  /usr/local/nginx/conf/nginx.conf
EXPOSE 80
ENTRYPOINT /usr/local/nginx/sbin/nginx && tail -f /etc/passwd

创建新的images为centos:nginx

[[email protected] ~]# docker build -t centos:nginx .

查看镜像

[[email protected] ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
centos              nginx               cafeea92311c        About a minute ago   372MB
centos              latest              e934aafc2206        2 days ago           199MB

映射容器端口

[[email protected] ~]# docker run -itd -p 80:80 centos:nginx /bin/bash
37531c1c18a176dd9fb2f77620e3285100628f86c21e0cfc887f2b8746670019

在浏览器中访问

原文地址:http://blog.51cto.com/13480443/2097526

时间: 2024-11-08 22:36:17

Dockerfile(七)安装nginx的相关文章

dockerfile实例--安装nginx

[[email protected] ~]# vi Dockerfile //ADD FROM centos_with_net MAINTAINER frankie [email protected]163.com RUN yum install -y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel ADD http://nginx.org/download/nginx-1.8.0.tar.gz RUN tar z

2.8-dockerfile示例-安装nginx

Dockerfile创建镜像 – Dockerfile示例安装nginx 先下载nginx的配置文件到当前目录下 wget http://www.apelearn.com/study_v2/.nginx_conf vim Dockerfile //内容如下 ############################################################# # Dockerfile to build Nginx Installed Containers # Based on

(七)saltstack项目实战_安装nginx

创建nginx所需目录 [[email protected] ~]# cd /data/etc/salt/ [[email protected] salt]# mkdir -p nginx/files [[email protected] salt]# cd nginx/files/ [[email protected] files]# wget http://nginx.org/download/nginx-1.11.3.tar.gz [[email protected] salt]# tre

安装Nginx的Dockerfile实例

#################################################Dockerfile to build Nginx Installed Containers##Based on CentOS                                      ##################################################Set the base image to CentOSFROM centos#File Autho

centos7编译安装nginx

linux及nginx版本 CentOS Linux release 7.2.1511 nginx-1.11.9 第一步安装依赖包 [[email protected] ~]# yum -y install pcre pcre-devel gcc openssl openssl-devel 第二步创建nginx用户 [[email protected] ~]# useradd nginx -s /sbin/nologin -M 第三部进入下载的nginx目录下编译 [[email protect

服务器 CentOS上yum安装Nginx服务

一.更改yum源为网易的源加快速度 vi /etc/yum.repos.d/CentOS-Base.repo 更改内容如下 # CentOS-Base.repo # # This file uses a new mirrorlist system developed by Lance Davis for CentOS. # The mirror system uses the connecting IP address of the client and the # update status

Linux--centos6.5 安装nginx+tomcat 服务器整合

Linux*centos6.5 安装nginx+tomcat 服务器整合 前言:研究了2天也出现过很多错误,网上的资料很多但是都不是很全,我是拼凑出来在结合自己的理解配置出来的,怕以后忘了记载在这里,如有不对的地方还请包涵. 一.首先,你要安装jdk(我的版本问1.8)自己到官网下载(我是root的权限). 我的服务器环境为---centos 6.5 64 [[email protected] ROOT]# rpm -ivh jdk-8u60-linux-x64.rpm [[email prot

第九天 1-8 实战:安装nginx服务器

简介:使用nginx源码包,安装nginx服务器,并对其进行配置后,测试其成果.模仿百度主页! 第一步:检查依赖关系[[email protected] ~]# rpm -q zlib-devel pcre-develpackage zlib-devel is not installedpackage pcre-devel is not installed[[email protected] ~]# ls /mnt/Packages/*zlib*/mnt/Packages/zlib-1.2.7-

Centos6.4 编译安装 nginx php

一. 准备依赖库 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 二. 编译安装pcre pcre 是一个正则表达式的库,编译nginx需要依赖该库实现url rewrite 下载源码 cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.tar.b