compose: [BUG] service is required by service but is disabled
Description
v2.19.0 introduced a change that broke a docker compose run command that was working previously (v2.18.1)
The change, I believe, would have come from this PR: https://github.com/docker/compose/pull/10602
docker compose -p unique_name run --rm --no-deps test black --line-length 150 --check app/ tests/
Error: service postgres is required by test but is disabled. Can be enabled by profiles []
I believe this is roughly all that would be required to reproduce, but I haven’t directly tested this as docker mac hasn’t updated docker compose yet:
version: "3"
services:
test:
profiles:
- test
build:
context: .
depends_on:
postgres
postgres:
image: postgres:14-alpine
Steps To Reproduce
No response
Compose Version
v2.19.0
Docker Environment
No response
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 25
- Comments: 22 (1 by maintainers)
Commits related to this issue
- Fix: CI can't run the analysis step (docker error) This is a bug introduced in docker compose v2.19.0: https://github.com/docker/compose/issues/10751 — committed to instedd/cdx by ysbaddaden a year ago
- Fix: CI can't run the analysis step (docker error) This is a bug introduced in docker compose v2.19.0: https://github.com/docker/compose/issues/10751 — committed to instedd/cdx by ysbaddaden a year ago
- Fix: CI can't run the analysis step (docker error) This is a bug introduced in docker compose v2.19.0: https://github.com/docker/compose/issues/10751 — committed to instedd/cdx by ysbaddaden a year ago
- Fix: CI can't run the analysis step (docker error) (#1957) This is a bug introduced in docker compose v2.19.0: https://github.com/docker/compose/issues/10751 — committed to instedd/cdx by ysbaddaden a year ago
- General nih tables exporting (#1956) * General nih tables exporting * Lint fixes and tests added * Fixes PR review * Fix: CI can't run the analysis step (docker error) (#1957) This is a b... — committed to instedd/cdx by leandroradusky a year ago
- Downgrade docker compose from 2.19.1 to 2.18.1 Because of https://github.com/docker/compose/issues/10751 — committed to felipecrs/jenkins-agent-dind by felipecrs a year ago
- Update DOCKER.md - Correct docker compose versions - bug from 2.19.0 … (#8427) * Update DOCKER.md - Correct docker compose versions - bug from 2.19.0 upwards Docker Compose version 2.19.0 and up h... — committed to DefectDojo/django-DefectDojo by testaccount90009 a year ago
I think the issue is still present on version
2.20.2
.I can confirm that the version
v2.18.1
works while2.19.0
shows the issue. Going back to the older version for CI as suggested by @allanlewis solves the issue.I’m working around this by adding these steps to my failing job:
It seems to work, and the download is very fast, presumably because it’s all within GitHub.
I’m having this issue on version
2.19.1
. Here’s mydocker-compose.yaml
(env vars and volumes are trimmed for simplicity):Basically when I’m restarting the
api
service, I get the error message reported in the issue.It seems like it specifically fails if the service we want to run with no deps has to be built; this repo has a consistently failing minimal project: https://github.com/luord/dc-test
The only change is from
image: busybox
tobuild: .
and a Dockerfile with onlyFROM busybox
.On that note, a workaround that seems to work for me that doesn’t require reinstalling the previous docker version is building the image before
docker run
, i.e.:Uhm @bdashrad I don’t think this is the case, in my case the list of profiles is always empty. Furthermore, I noticed this only happens when running
docker-compose restart
, all other commands seem to be working as expected.I’m hitting this issue on 2.20.2 as well