Discussions
Change mongodb default volume mapping
about 3 years ago by Dom Bavetta
By default, the MongoDB image persists its database under a volume located at /data/db
. Any idea how I can change this via Medstack control? This is easy enough to configure in a docker-compose file, as represented below. With the following configuration, the MongoDB database gets stored under /mongodb/data
instead of /data/db
. I'd like to match this behavior in my MedStack cluster.
mongo:
container_name: mongo-server
image: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: ****
MONGO_INITDB_ROOT_PASSWORD: ****
volumes:
- /mongodb/data:/data/db
ports:
- 27017:27017
References: