You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when I docker compose run --no-deps a service that depends on another service it runs fine when the said service has already been built but fails when docker compose run needs to build it. It seems like this is triggered by the --no-deps flag because without it the service builds and runs just fine.
Steps To Reproduce
Here is a Dockerfile and docker-compose.yml to reproduce the issue.
Dockerfile:
FROM alpine:latest AS service1
CMD ["echo", "hello from service1"]
FROM alpine:latest AS service2
CMD ["echo", "hello from service2"]
Running docker compose run --no-deps service2 will fail with the following error:
[+] Creating 1/0
✔ Network dcr-bug_default Created 0.0s
[+] Building 0.0s (0/0)
service service1 is required by service2 but is disabled. Can be enabled by profiles []
Whereas running docker compose build service2 && docker compose run --no-deps service2 will give the expected output:
[+] Building 3.7s (6/6) FINISHED
...
[+] Creating 1/0
✔ Network dcr-bug_default Created 0.0s
hello from service2
Running docker compose run service2 works fine too, it will build and run both services without a problem.
Note: I used docker system prune -a to reset my environment when testing this.
Compose Version
> docker compose version
Docker Compose version v2.19.1
> docker-compose version
Docker Compose version v2.19.1
Description
I noticed that when I
docker compose run --no-deps
a service that depends on another service it runs fine when the said service has already been built but fails whendocker compose run
needs to build it. It seems like this is triggered by the--no-deps
flag because without it the service builds and runs just fine.Steps To Reproduce
Here is a
Dockerfile
anddocker-compose.yml
to reproduce the issue.Dockerfile:
docker-compose.yml:
Running
docker compose run --no-deps service2
will fail with the following error:Whereas running
docker compose build service2 && docker compose run --no-deps service2
will give the expected output:Running
docker compose run service2
works fine too, it will build and run both services without a problem.Note: I used
docker system prune -a
to reset my environment when testing this.Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: