This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 注释: Dockerfile RUN指令
FROM nginx
WORKDIR /app
# 注意:只执行最后一个CMD
# CMD /bin/sh -c 'echo 我是CMD指令shell方式执行后写入的内容'
CMD ["/bin/sh", "-c", "echo exec方式执行后写入的内容"]
# 提供默认参数,与 ENTRYPOINT 指令配合使用
# CMD ["-c", "echo 为 ENTRYPOINT 提供默认参数"]
# ENTRYPOINT [ "/bin/sh" ]
# 注意:后台运行的话,因为执行完成cmd命令后,进程结束。容器就自动退出了。
# docker build --rm -f Dockerfile.CMD -t study:buildcmd1 .
# docker run --rm -it --name cmd.study study:buildcmd1