New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARG persists across build stages with buildkit, deviating from default docker behavior #1977
Comments
I encountered this unexpected buildkit behavior and interpreted the documentation the same way as the OP when I attempted to build a Dockerfile from another FOSS project without buildkit. Thankfully, it failed since the command in For example, consider the consequences of the difference between standard docker builds and buildkit builds with this dockerfile in Docker v19.03:
|
Same problem here, dunno why no one take in account this. Thanks. |
Temporary fix i found out is to add the variable that i do not want to be propagated to the "child" stage to build-arg with and empty value.
Using buildkit inside But all this make no sense and is clearly a bug that should be fixed. |
I seem to have found differing behavior between buildkit & docker when building:
I get differing behavior between default docker & buildkit. Default seems to be in line with the documentation, while buildkit seems to deviate.
As you can see, with buildkit, the ARG is still set in the second stage, while with regular docker build, it is not set in the second stage (in accordance with the documentation AFAIK).
Relevant docs: https://docs.docker.com/engine/reference/builder/#scope
The text was updated successfully, but these errors were encountered: