Stop a Docker container and remove its volumes

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 monthly insights, personal stories, and in-depth information about what I find helpful in web development as a freelancer.

Email advice once a month + Free XState report + Free course on XState

Want to see what it looks like? View the previous issues.

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