Open maciejpankanin opened 1 year ago
ignoring the dependency was a bug, that we fixed. But as many did like you relied on this, we introduced required
as a flag to mark a dependency as "nice to have", see https://github.com/docker/compose/pull/10792
Closing as a duplicate for https://github.com/compose-spec/compose-spec/issues/274
OK, thanks :)
But talking about this logs
output, do you think it is OK?
indeed, I missed the "logs" issue as a sub-issue here :)
While skimming through this issue and related PR, I came up with these two questions:
up
(without profiles), should the dependency check pass in case required dependencies are in profiles, but they're already up?down
(without profiles), should the services without profiles be stopped and removed, regardless of any dependencies in profiles?I'm trying to use a single instance of database as required dependency of multiple Compose projects. My idea was to merge the database's Compose file (via COMPOSE_FILES
), and put the database service in a profile, so I don't accidentally destroy the database when playing with database-dependent Compose projects.
Obviously it's not working this way, at least not in Compose 2.21.0
.
I'm gonna tag on to this thread for clarification reasons. In previous history, depends_on
was ignored when running the build
or pull
commands.
i.e. I could have a service which depended on another for runtime reasons, but they were in different profiles to select which images to build at particular times etc.
However, with the latest docker compose, it appears that depends_on produces the "invalid compose project" command line error for build
and pull
now. Is that expected or unintended behavior?
For example:
services:
# pretend like this service provides a cli to a web server, can be pulled from dockerhub
cli:
profiles: ["all", "cli", "pull"]
image: busybox
# since the cli is to be run against the web server, we mark as dependent
# however, to build or pull the image, this shouldn't matter
depends_on:
web:
condition: service_started
# pretend like this webserver does stuff... and is built locally, not in "pull" profile
web:
profiles: ["all", "web"]
image: nginx
If i just want to select images to be pulled, or built, I get errors where previous docker compose versions i did not (i.e. 2.3.3)
$ docker compose --profile pull pull
service "cli" depends on undefined service "web": invalid compose project
$ docker compose --profile cli build
service "cli" depends on undefined service "web": invalid compose project
$ docker compose version
Docker Compose version v2.27.0
If this is unintended and i need to open a separate issue just lmk please.
(note: the workaround is to set required: false
, but i thought build & pull weren't supposed to care about depends_on)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as not stale anymore due to the recent activity.
Description
Imagine a stack like this:
In previous versions of
docker compose
I could rundocker compose up
and it would start thedb
container without any problems. Recently I upgradeddocker
and was really surprised that it didn't work anymore. Here is the output of `docker compose up':This is a devastating change for many compose stacks, and wasn't even mentioned in the changelog :(
There is also another surprising behaviour when running
docker compose logs db
reports:Steps To Reproduce
docker compose up
with the config above.Compose Version
Docker Environment
Anything else?
No response