Does docker compose down Delete Your Data? Named Volumes Explained
Running docker compose down removes containers and project networks but keeps named volumes, so database files persist across restarts. Adding the --volumes flag also removes the project's managed volumes, which effectively resets stored data. Compose prefixes managed volume names with the project name, so renaming a project or moving its Compose file can make the application attach to a different, empty volume. The article advises checking existing volumes with docker volume ls and docker volume inspect before assuming data is lost. It recommends using stop or down for routine shutdowns, reserving --volumes for deliberate cleanup, and keeping backups of irreplaceable data.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in