-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unexpected result when using build args with default values #3281
Comments
I guess if the value is unset we should omit it from the args sent to |
@dnephin exactly, that would be my preferred solution. This way, default values defined in the This could be seen as a new feature though. The intermediate step, if needed, would be to just send an empty string instead of the |
Yep, that would also be helpful for building images behind HTTP proxies. I have the following
and the following
When I run
What I would expect is, in fact, the same behaviour as when
If that were the case, my |
Fix #3281: Unexpected result when using build args with default values
@aanand what about FOO="None" ? |
@triccardi-systran You're looking at the wrong commit - a67ba55 is the actual fix. |
@aanand my bad, the commits listed on this page by github are misleading: PR #3449 is missing, but early commits from this PR are (that's where I found e3e8a61). I confirm this works: now undefined build args are passed to docker build as empty strings. However, this is the proposed behavior 1. The proposed behavior 2 would be better IMO, as initially explained. Should I open a new issue for that ? |
It's not too late - we're not committed to the current behaviour until the stable 1.8.0 release. Feel free to open a new issue so we can discuss which behaviour would be ideal. |
@aanand I opened a new issue as you suggested, it was 2 weeks ago, I'm starting to worry about compose 1.8.0 being released with this issue not fully resolved. |
… values Fix the issue when build arg is set to None instead of empty string. Usecase: cat docker-compose.yml .... args: - http_proxy - https_proxy - no_proxy If http_proxy, https_proxy, no_proxy environment variables are not defined then http_proxy, https_proxy, no_proxy build args will be set to string None which breaks all downloads With this change build args will not passed to docker engine if they are equal to string None Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
… values Fix the issue when build arg is set to None instead of empty string. Usecase: cat docker-compose.yml .... args: - http_proxy - https_proxy - no_proxy If http_proxy, https_proxy, no_proxy environment variables are not defined then http_proxy, https_proxy, no_proxy build args will be set to string None which breaks all downloads With this change undefined build args will be set to empty string instead of string None Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com>
… values Fix the issue when build arg is set to None instead of empty string. Usecase: cat docker-compose.yml .... args: - http_proxy - https_proxy - no_proxy If http_proxy, https_proxy, no_proxy environment variables are not defined then http_proxy, https_proxy, no_proxy build args will be set to string None which breaks all downloads With this change undefined build args will be set to empty string instead of string None Signed-off-by: Andrey Devyatkin <andrey.a.devyatkin@gmail.com> Signed-off-by: Alexander Schneider <alexanderschneider85@gmail.com>
Scenario:
Files
Dockerfile
:docker-compose.yml
:Execution:
( same result with 1.7.1-rc1 which includes PR #2938 )
Issue
Expected result:
prints
-1-
.Actual result:
prints
-None-
.Details:
Compose has no value for
FOO
build arg from its environment, so it could either send an empty string todocker build
, or better: not send this build arg todocker build
.The second one would be great: it would open the possibility to use the default value for the build arg as defined in the
Dockerfile
. ( For now the workaround is to duplicate the default values fromDockerfile
to.env
, only works with >=1.7.0).The first one would be still better than the current behavior.
Current behavior: no value in Compose environment is represented in python as
None
, then casted to a string"None"
, which is probably always bad.The text was updated successfully, but these errors were encountered: