-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 use --no-build with services with a build section #8785
Comments
Hi. Doesn't seem like a bug to me, could be wrong. First of all yours and my error messages are not the same. Mine says "invalid service "repro". Must specify either image or build" because I'm explicitely asking it to ignore any build instructions. Even if the image was build previously, how would compose know its id or name from literally nothing related? To fix this just add an image section. services: PS: my backtick key isn't working. |
I don't think that should be needed; the
If a service only has a
From the above, I think this is a bug; removing the |
Ah thanks Sabastiaan! Didn't know about that. Probably because I never not used an image key :p |
FWIW, this is causing regressions for Visual Studio with docker-compose projects. These projects regularly perform The workaround is to add an |
When using
docker compose up --no-build
a check is done to ensure eitherimage
orbuild
exists in a service:compose/pkg/compose/build.go
Line 98 in 7365917
compose/pkg/compose/create.go
Line 66 in ef786f9
However as the
build
section is removed increateOptions.Apply
when--no-build
is specifiedcompose/cmd/compose/create.go
Line 117 in 7c47673
This means that
docker compose up --no-build
always fails even if you've ensured these images have been built.Full repro here: https://github.com/z0w13/docker-compose-no-build-repro
Output of
docker compose version
:The behaviour in 1.x was (in my opinion) correct, failing if the image hasn't been preivously built and otherwise succeeding:
The text was updated successfully, but these errors were encountered: