Dockerfils命令详解:https://www.cnblogs.com/panwenbin-logs/p/8007348.html
以nginx为例:
#-----------dockerfile构建镜像--------
dockerfile包括:
1、基础镜像信息
2、维护者信息
3、镜像操作指令
4、容器启动时执行指令
dockerfile目录:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#This is My first Dockerfile #Version 1.0 #Author: YangYangming #Base images FROM centos #MAINTAINER MAINTAINER YangYangming #ADD ADD pcre - 8.37 .tar.gz / usr / local / src ADD nginx - 1.17 . 5.tar .gz / usr / local / src #RUN RUN yum install - y wget gcc gcc - c + + make openssl - devel RUN useradd - s / sbin / nologin - M www #WORKDIR WORKDIR / usr / local / src / nginx - 1.17 . 5 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.37 && make && make install RUN echo "daemon off;" >> / usr / local / nginx / conf / nginx.conf ENV PATH / usr / local / nginx / sbin:$PATH EXPOSE 80 CMD [ "nginx" ] |
构建Dcokerfile:
docker build -t nginx-file:v1 .