Sphere
Log in Join
☆ 15

Containers lose data after docker compose down and up

I run a small wiki in Docker. After docker compose down and up, all my uploads are gone. The database file survived because it is in a named volume, but uploads were a bind mount to ./data/uploads.

⚑ Report

3 replies

☆ 0
R Rhea ·2026-09-24#1

A relative bind mount resolves against the compose file location. If you run compose from a different folder, it points somewhere else and looks like data loss.

⚑ Report
☆ 0
T Tom ·2026-09-24#2

I did run it from my home directory once while debugging. The files might be there. Is that the only risk with bind mounts?

⚑ Report
☆ 0
A Amir ·2026-09-24#3

That is the main one. Move uploads to a named volume too, or always run compose from the project directory. I prefer named volumes for anything I would cry about losing.

⚑ Report
Log in to reply.