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.
|
|
|
|
# 注释: ENTRYPOINT 入口指令
|
|
|
|
|
FROM ubuntu
|
|
|
|
|
|
|
|
|
|
# ENTRYPOINT ["top"]
|
|
|
|
|
|
|
|
|
|
# ENTRYPOINT ["top", "-b","-c"]
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["top"]
|
|
|
|
|
CMD ["-c","-b"]
|
|
|
|
|
|
|
|
|
|
# 构建镜像
|
|
|
|
|
# docker build -f Dockerfile.ENTRYPOINT -t study.dockerfile.entrypoint:latest -t study.dockerfile.entrypoint:0.0.1 .
|
|
|
|
|
|
|
|
|
|
# docker run -it --rm study.dockerfile.entrypoint
|
|
|
|
|
|
|
|
|
|
# --entrypoint 覆盖 ENTRYPOINT指令
|
|
|
|
|
# docker run -it --rm --entrypoint="ls" study.dockerfile.entrypoint
|
|
|
|
|
|
|
|
|
|
# --entrypoint不能包含命令参数,如下是错误的
|
|
|
|
|
# docker run -it --rm --entrypoint="top -b -c" study.dockerfile.entrypoint
|
|
|
|
|
|
|
|
|
|
# --entrypoint不能包含命令里的参数,应该放在[COMMAND]位置,正确例子:
|
|
|
|
|
# docker run -it --rm --entrypoint="top" study.dockerfile.entrypoint -b -c
|