master
parent
11c69141ac
commit
64859417f5
@ -0,0 +1,18 @@
|
||||
# 注释: Dockerfile CMD指令,NGINX后台服务例子
|
||||
FROM nginx
|
||||
|
||||
# 变参
|
||||
CMD ["nginx.conf"]
|
||||
# 定参
|
||||
ENTRYPOINT ["nginx", "-c"]
|
||||
|
||||
# docker build --rm -f Dockerfile.CMD2 -t study:buildcmd.nginx1 .
|
||||
|
||||
# 不传参运行
|
||||
# docker run -d study:buildcmd.nginx1
|
||||
# 容器内会默认运行以下命令,启动主进程 nginx -c /etc/nginx/nginx.conf
|
||||
|
||||
# 传参运行
|
||||
# docker run study:buildcmd.nginx1 -c /etc/nginx/new.conf
|
||||
# 容器内会默认运行以下命令,启动主进程(/etc/nginx/new.conf:假设容器内已有此文件)
|
||||
# nginx -c /etc/nginx/new.conf
|
Loading…
Reference in New Issue