3-7 entrypoint
来源:3-7 RUN vs CMD vs Entrypoint
weixin_慕标2479954
2020-10-10
老师,3-7 中最后执行的命令是
docker run -it xiaopeng163/centos-entrypoint-shell /bin/bash
为什么仅仅是打印了hello docker。我理解的是应该打印完hello docker后,进入到centos-entrypoint-shell容器里。但是实验结果只是打印了hello docker,并没有进到容器里,为啥呀?
写回答
1回答
-
麦兜搞IT
2020-12-13
您好,因为进程entrypoint结束执行了。
如果想不让其退出而进入bash,两个办法
第一个:删除entrypoint,使用cmd
FROM centos ENV name Docker #ENTRYPOINT echo "hello $name" CMD []
第二个,让entrypoint的里的进程不要退出, 并且搞到后台执行。
00
相似问题