美文网首页
dockerfile中的entrypoint和cmd区别

dockerfile中的entrypoint和cmd区别

作者: 多余的午宴 | 来源:发表于2019-04-09 10:55 被阅读0次

格式两种:

  1. exec格式: ['/bin/sh', '-c', 'echo hello']
  2. shell格式: 一串字符串

执行流程:
容器的入口是entrypoint,启动容器,容器先执行entrypoint

区别:
shell格式的entrypoint是容器必须且第一步执行的,exec格式的entrypoint就存在被cmd替换掉参数的可能。
cmd会被docker run之后的参数替换掉,如果entrypoint是shell格式的,则不能被替换掉。

相关文章

网友评论

      本文标题:dockerfile中的entrypoint和cmd区别

      本文链接:https://www.haomeiwen.com/subject/ezzviqtx.html