Why can't I use the build arg again after FROM in a Dockerfile?

放肆的年华 提交于 2019-12-01 08:18:13

Why can't I use the FROM_IMAGE build arg twice, on and after a FROM line?

There is a real difference depending on where you put ARG related to FROM line:

  • any ARG before the first FROM can be used in any FROM line
  • any ARG within a build stage (after a FROM) can be used in that build stage

This is related to build stages mechanics and some reference of actual behavior can be found here: https://github.com/docker/cli/pull/333, and a discussion on why documentation and build mechanics is a bit confusing on ARG usage is here: https://github.com/moby/moby/issues/34129

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!