I'm trying to clear out all the data from my Docker container, but it seems to persist even after I delete the container and image. I've noticed that the SQLite database data is kept somewhere. I'm working with Docker on a Windows 11 machine, and I'm quite new to this. Can anyone help me with how to fully delete this data so I can start fresh? I found out that the data is linked to the container name and tag, as changing the container name gives a sort of reset, but the old data is still lurking around somewhere. Any advice?
4 Answers
If you're using Docker Compose, try the command `docker compose down --volumes`. This will clear the volumes, though it doesn't affect bind mounts.
Your data is likely still there because the SQLite database is either in a Docker volume or a bind mount. To delete it, do this:
1. List your volumes with `docker volume ls`.
2. Remove all unused volumes using `docker volume prune`.
3. For a clean slate, you can run `docker system prune -a --volumes` which wipes containers, images, and volumes.
If you're using a bind mount, you need to delete the SQLite database directly from your host system, usually found in `\wsl$docker-desktop-dataversion-pack-datacommunitydockervolumes`. Get rid of it from there, and you should be set!
If your SQLite database is within the Docker container, make sure to remove the volume that’s associated with it. You can find out which volumes you have by running `docker volume ls`. If you want to unload dangling volumes, run `docker system prune` and that should help clear things up!
What command are you using to launch your container? Knowing that can help us figure out what’s going wrong.
I’m using this command:
docker run -d --name mybibliotheca -p 5054:5054 -v /path/to/data:/app/data -e TIMEZONE=Asia/Singapore -e WORKERS=6 --restart unless-stopped pickles4evaaaa/mybibliotheca:latest