Skip to content
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

Support --build-arg in docker-compose build #3790

Closed
agilgur5 opened this issue Jul 29, 2016 · 2 comments
Closed

Support --build-arg in docker-compose build #3790

agilgur5 opened this issue Jul 29, 2016 · 2 comments
Milestone

Comments

@agilgur5
Copy link

agilgur5 commented Jul 29, 2016

Similarly to how Compose now supports the run -e ENV_VAR= option to mirror the behavior of docker, it would be extremely useful for Compose to also support build --build-arg ENV_VAR=.

This would fix some of the issues in #3608 ; without this option, it's very hard to use the Dockerfile's optionally overrideable ARG syntax (e.g. ARG=YOU_CAN_OVERRIDE_ME_WITH_BUILD_ARG).
One currently has to use the docker-compose.yml file's args: option, which effectively either hard-codes the build argument or requires one to use a .env file in conjunction that duplicates the Dockerfile's default argument.

@agilgur5 agilgur5 changed the title Support --build-args in docker-compose build Support --build-arg in docker-compose build Jul 29, 2016
@dattran-vn01
Copy link

dattran-vn01 commented Aug 11, 2016

Hello, I wanted to learn docker-compose code and created one pull request to support this

@shin-
Copy link

shin- commented Mar 8, 2017

Closing via #4564

@shin- shin- closed this as completed Mar 8, 2017
shin- pushed a commit that referenced this issue Feb 21, 2018
Currently, `docker-compose --build-arg` requires that a service be
specified as part of the command-line invocation. So,

  $ docker-compose build --build-arg nocache=`git rev-parse @` foom

works. However, when using out-of-band scripts to automate the build
process of several Docker containers (in a CI system, for instance), it
becomes difficult to specify exactly which service requires the
build-arg. Docker has supported Dockerfiles that ignore build-args for a
long time, so there is no problem is specifying spurious build-args to
builds that don't consume it.

The limitation on `docker-compose build` today is artificial, and there
are no other commands that require specifying a service. Allow
`--build-arg` to also match all services so this is possible:

  $ docker-compose build --build-arg nocache=`git rev-parse @`

Please refer to #3790 for discussion on the original feature.

Signed-off-by: Ramkumar Ramachandra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants