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

Can't set build --no-cache option as "--no-cache=true" #4667

Closed
dirkschneemann opened this issue Mar 24, 2017 · 6 comments
Closed

Can't set build --no-cache option as "--no-cache=true" #4667

dirkschneemann opened this issue Mar 24, 2017 · 6 comments

Comments

@dirkschneemann
Copy link

With regular Docker commands, I can do:
docker build --no-cache .
or
docker build --no-cache=true .

In docker-compose, however, this one works
docker-compose build --no-cache
while this one
docker-compose build --no-cache=true
fails with

Build or rebuild services.

Services are built once and then tagged as `project_service`,
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `docker-compose build` to rebuild it.

Usage: build [options] [SERVICE...]

Options:
    --force-rm  Always remove intermediate containers.
    --no-cache  Do not use cache when building the image.
    --pull      Always attempt to pull a newer version of the image.

Is there a specific reason for this inconsistency? Using the more explicit form would be useful for me in the context of a Jenkins job with a "boolean parameter" which is a checkbox, setting a bash variable to "true" or "false".

@dirkschneemann dirkschneemann changed the title Can't set --no-cache option as "--no-cache=true" Can't set build --no-cache option as "--no-cache=true" Mar 24, 2017
@MichaelPereira
Copy link

This inconsistency comes from the current implementation of the command which doesn't take those cases into account:

no_cache=bool(options.get('--no-cache', False)),

I'm not sure how to properly change it to support the following supported version by the docker command:

  • --no-cache=true
  • --no-cache=false
  • --no-cache=1
  • --no-cache=0

@shin-
Copy link

shin- commented Mar 27, 2017

We use a different command-line parser because docker-compose is written in a different language (Python versus Go).

@dirkschneemann
Copy link
Author

dirkschneemann commented Mar 28, 2017

That makes sense, thank you for the clarification, @MichaelPereira and @shin- . Would it be possible to align docker-compose's behaviour to that of the docker command? Or is this not possible with docopt (which is used in docker-compose as far as I understand)?

@shin-
Copy link

shin- commented Mar 28, 2017

I don't believe docopt supports it. If they release a new version that does, we'll be happy to include it, but I don't really see us spending any time on this otherwise.

@dirkschneemann
Copy link
Author

Alright, don't worry, this is certainly not the most important issue and one can easily work around it. Cheers

@ijc ijc closed this as completed May 22, 2019
@nise
Copy link

nise commented Aug 26, 2021

What are the workarounds for this? How can I prohibit caching in docker-compose or in the Dockerfile?

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

5 participants