On my dev machine I’m running MongoDB inside a docker container (Docker Native 1.13.0-rc2-beta31, MacOSX).
Here’s the docker-compose.yml
:
version: '2'
services:
mongo:
image: mongo
ports:
- 27017:27017
volumes:
- ./mongo-data:/data
It starts smoothly and creates 2 directories inside of ./mongo-data
: db
and configdb
.
Now the strange thing:
- if I
ls ./mongo-data/db
orls ./mongo-data/configdb
from the host I don’t get any file listed - if I do the same (
ls /data/db
orls /data/configdb
) from inside the container I see the MongoDB files I’m expecting to see there
What’s goin on here?
One more thing: if I erase the directories from the host they and their content get erased from the container as well.
Any help on this?
Update
On thing that’s even more strange is that when I delete the files from the host the mongo process goes nuts, but if I restart via docker-compose up --force-recreate
the files I deleted seem to be there again untouched (in the container).