Skip to content

chore(mongo): reduce overlapping volume mounts to single /data mount#506

Merged
wax911 merged 5 commits into
devfrom
chore/mongo-volume-validation
Jun 26, 2026
Merged

chore(mongo): reduce overlapping volume mounts to single /data mount#506
wax911 merged 5 commits into
devfrom
chore/mongo-volume-validation

Conversation

@wax911

@wax911 wax911 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Closes #504.

Removes redundant /data/db and /data/configdb volume mounts. MongoDB's default dbPath and config DB path are subdirectories of /data, so the single mount covers all persistence needs.

wax911 added 4 commits June 26, 2026 23:52
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 wax911 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/configdb

Source: 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:

  1. Remove only the parent /data mount and keep exact mounts for /data/db and /data/configdb.
  2. Use separate named volumes for /data/db and /data/configdb.
  3. Keep this PR's single /data approach 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.

… declarations

Replace the parent /data mount with explicit /data/db and /data/configdb
mounts.  The official Mongo image Dockerfile declares VOLUME /data/db
/data/configdb; a parent mount may leave Docker-managed anonymous child
volumes for those exact paths.

Ref: #504, review feedback on #506
@wax911 wax911 merged commit d465920 into dev Jun 26, 2026
5 checks passed
@wax911 wax911 deleted the chore/mongo-volume-validation branch June 26, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(mongo): validate overlapping mongo-data volume mounts

1 participant