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.

17 lines
598 B
Batchfile

This file contains ambiguous Unicode characters!

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 CMD指令
FROM busybox
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