You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
558 B
Docker

# 注释: 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