compose: [BUG] `up` Incorrectly recreates containers with no changes

Description

Since updating to 2.16, docker compose up incorrectly recreates containers when they haven’t changed. This only appears to happen for services that are defined in another file and included with extends.

Steps To Reproduce

  1. Define a service in a separate YAML file and include the file in docker-compose.yml with extends
  2. Run docker compose up -d multiple times
  3. Service will recreate+start each time

Compose Version

Docker Compose version 2.16.0

Docker Environment

No response

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 9
  • Comments: 16 (1 by maintainers)

Most upvoted comments

There was a regression in v2.16.0 that’s fixed by #10275 which would cause Compose to keep re-creating containers unnecessarily on up after the first time.

This will be fixed in the next Compose release.

This happens to me too, without extend, any time a service gets an image update, docker compose up always recreate the container even though it’s already running the newest image.

One workaround is to manually docker compose down first then docker compose up again.

It took for ever for 2.17.2 to be available for installation using apt, but now that it is it solved my issue! Thanks for the great work!

Oh, that was my mistake. You are absolutely right, currently version 2.17.0 is only available as a release candidate. I loaded the version automatically via script and had not paid attention to the exact git tag. Sorry for the confusion 😉