Skip to content
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

truly persistent volumes #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JohnRDOrazio
Copy link
Contributor

Named volumes created in docker compose are not actually truly persistent, they will be removed by docker compose down. This is an alternative method to create truly persistent volumes that will not be removed by docker compose down.

@DavidMStraub
Copy link
Member

I never had any volumes deleted by this command and this is not the intended behaviour according to the docker documentation. So I don't think this is needed. Or can you point to docker documentation of this behaviour?

@JohnRDOrazio
Copy link
Contributor Author

https://docs.docker.com/reference/cli/docker/compose/down/

docker compose down

Stops containers and removes containers, networks, volumes, and images created by up.
Networks and volumes defined as external are never removed.

It does also state that volumes are not removed by default unless the -v flag is used. However I have had volumes removed on more than one occasion. It might have something to do with other environment settings that change the defaults, I'm not sure.

In any case, defining a volume as external is a safer bet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants