Stop a Docker container and remove its volumes

Published on


Sometimes I want to restart from the ground up a database launched in a Docker container and to remove its data entirely.

I found that docker compose down command has an option to do so:

bash
docker-compose down <container name> --volumes

That way, the volumes attached to <container name> will be removed as well as the container.

Join my mailing list

Get new articles directly in your inbox.

I value your privacy and will never share your email address.