Reputation: 19414
I'd like to run mongo in a docker container, alongside some others I'm using via docker-compose.
I thought mounting the volume like so would allow for it to persist data outside the container:
db:
image: mongo
command: -smallfiles -nojournal
volumes:
- ./mongo_data:/data
It seems to create some directories, but there's no files on the host mount. The data files are present on the container.
$ find mongo_data
mongo_data
mongo_data/configdb
mongo_data/db
Upvotes: 1
Views: 1510
Reputation: 19414
This seems to work:
db:
image: mongo:3
# command: -smallfiles -nojournal
volumes:
- ./mongo_data:/data/db
I suspect it's just the change to the volumes value.
Upvotes: 2