Reputation: 1518
When using a docker ACI context, the following docker-compose file fails. The mongodb container continuously restarts.
version: "3.9"
services:
mongodb:
image: mongo:5.0.6
env_file: mongo.env
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=changeit
ports:
- 27017
volumes:
- dbdata:/data/db
volumes:
dbdata:
driver: azure_file
driver_opts:
share_name: mongodb-data
storage_account_name: kpncoqyuxumoetuftz
If I don't use the azure_file storage it will run ok (But of course the data won't be persistent)
Upvotes: 5
Views: 1275
Reputation: 1518
I am not sure why I can't mount to the default directory /data/db
but to get this to work I had to mount to a different directory and then replace the default command with one that takes a parameter.
Working version is below:
version: "3.9"
services:
mongodb:
image: mongo:5.0.6
command: ["mongod", "--dbpath=/dbdata"]
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=changeit
ports:
- 27017
volumes:
- dbdata:/dbdata
volumes:
dbdata:
driver: azure_file
driver_opts:
share_name: mongodb-data
storage_account_name: kpncoqyuxumoetuftz
Upvotes: 1