-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] docker compose up does not recreate containers when named volume configuration is changed #10060
Comments
Nice catch. |
Actually, while I expected we did, volumes don't get re-created on configuration change - this involves a risk to loose data, so would at least require an explicit flag or user to confirm volume replacement. |
@ndeloof Hm, that doesn't seem consistent with what I'm experiencing.
If I |
@NReilingh because you change volume |
@ndeloof I might just not be getting this, but isn't that consistent with my initial issue? The only change was the Initial:
Change causes container re-creation:
Change does not cause container re-creation:
|
services:
changer:
volumes:
- foo:/path
volumes:
foo:
name: bar is equivalent to: services:
changer:
volumes:
- bar:/path
volumes:
bar: {}
As any attribute under |
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. |
also see #9203 for a comparable issue, which comes without the risk we delete user data while re-creating a volume after configuration changed! |
Description
Docker compose up is supposed to observe the state of running containers, compare this to the service definition, and recreate containers that need to be converged to the definition.
The options
--force-recreate
and--no-recreate
are meant to override this behavior, so they are not specified when you want containers only to be recreated if a change is needed to bring them in line with the service definition.When a service definition references a named volume defined in the top level element, currently a change to that volume configuration does not result in existing containers using that named volume being recreated.
Steps To Reproduce
This is tested on Docker Desktop Mac (Apple Silicon)
Run
docker compose up
first
is mounted to the containername: second
docker compose up
againExpected behavior is that the
changer
container is recreated so that it has a volume namedsecond
mounted.Actual behavior is that the container is not recreated, and still has the
first
volume mounted.Compose Version
Docker Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: