FROM 基礎鏡像
MAINTAINER 維護這信息
RUN 運行什麼命令,在命令前面加上RUN
ADD 往裡面加點文件,copy文件,會自動解壓
WORKDIR 當前的工作目錄
VOLUME 目錄掛載
EXPOSE 開放的端口
RUN 進程要一直運行
wget http://nginx.org/download/nginx-1.9.3.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
#This is My first Dockerfile#version 1.0 #Author: hh #Base image 基礎鏡像 FROM centos #MAINTAINER 維護者信息 MAINTAINER hh Wang #ADD ADD pcre-8.38.tar.gz /usr/local/srcADD nginx-1.9.3.tar.gz /usr/local/src #RUN RUN yum -y install wget gcc gcc-c++ make openssl openssl-devel RUN useradd -s /sbin/nologin -M www #WORKDIR WORKDIR /usr/local/src/nginx-1.9.3 RUN ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module \ --with-pcre=/usr/local/src/pcre-8.38 && make && make install RUN echo "daemon off;">>/usr/local/nginx/conf/nginx.conf #ENV定義環境變量 ENV PATH /usr/local/nginx/sbin:$PATH #EXPOSE 映射端口 EXPOSE 80 CMD ["nginx"]
docker build -t whh/nginx-file:v1 .
docker run -d -it -p 93:80 --name nginx whh/nginx-file:v1
http://xxxxxx/Linuxjc/1169728.html TechArticle