docker compose up recreates running container that does not have their configs changed in docker-compose.yml
Problem
Description `docker compose up` stops and recreates running containers that do not have their config changed. Steps to reproduce the issue: 1. Run `docker compose up` 2. Change config for one service in `docker-compose.yml` 3. Run `docker compose up` again Describe the results you received: A lot of containers that are not related to the service that has its config changed are recreated and restarted. Describe the results you expected: Only the container of the service that has new config should be recreated and those that depend on it should be restarted. Additional information you deem important (e.g. issue happens only occasionally): After switching to v2 it happens almost all of the time. Previously on v1 there was no such problem. Output of `docker compose version`: [code block] Output of `docker info`: [code block] Additional environment details: -
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: docker compose up recreates running container that does not have their configs changed in docker-compose.yml
I'm getting the same issue and all images are available locally. In my case, it's triggered by a `docker-compose run`, and a linked running container gets recreated even though nothing has changed. I checked the hash, it does not change across the unexpected recreates. EDIT: as pointed out in #10068, in my case the result of `docker-compose config --hash <service>` does not change, but the resu
Trust Score
3 verifications
- 1
I'm getting the same issue and all images are available locally.
I'm getting the same issue and all images are available locally.
- 2
In my case, it's triggered by a `docker-compose run`, and a linked running conta
In my case, it's triggered by a `docker-compose run`, and a linked running container gets recreated even though nothing has changed.
- 3
I checked the hash, it does not change across the unexpected recreates.
I checked the hash, it does not change across the unexpected recreates.
- 4
EDIT: as pointed out in #10068, in my case the result of `docker-compose config
EDIT: as pointed out in #10068, in my case the result of `docker-compose config --hash <service>` does not change, but the result of `docker inspect <container> -f '{{json .Config.Labels}}' | jq -r '."com.docker.compose.config-hash"'` does change
Validation
Resolved in docker/compose GitHub issue #9600. Community reactions: 3 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep