chore(mongo): reduce overlapping volume mounts to single /data mount#506
Conversation
Remove redundant /data/db and /data/configdb volume mounts. MongoDB's default dbPath and config DB path are subdirectories of /data, so the single /data mount covers all persistence needs. This resolves ambiguous mount behavior when the same volume is mounted at parent and child paths simultaneously. Ref: #504
wax911
left a comment
There was a problem hiding this comment.
This needs another pass before merge.
The intent from #504 was to remove ambiguity, but switching to only mongo-data:/data is not sufficiently validated for the official mongo image. The official docker-library Mongo Dockerfile template explicitly declares:
VOLUME /data/db /data/configdbSource: https://github.com/docker-library/mongo/blob/master/Dockerfile-linux.template
Because the image declares exact child volume paths, a parent /data mount may not prevent Docker from creating anonymous volumes for /data/db and /data/configdb. That would defeat the persistence simplification and make backup/restore semantics less obvious, not more obvious.
Safer options:
- Remove only the parent
/datamount and keep exact mounts for/data/dband/data/configdb. - Use separate named volumes for
/data/dband/data/configdb. - Keep this PR's single
/dataapproach only if runtime validation proves no anonymous child volumes are created for this image.
Also remove .slim/deepwork/issues-500-505.md from this PR. The #505 direction now lives in the issue comment and should not be duplicated inside an unrelated Mongo volume PR.
Closes #504.
Removes redundant
/data/dband/data/configdbvolume mounts. MongoDB's default dbPath and config DB path are subdirectories of/data, so the single mount covers all persistence needs.