Is it possible to change the user name from mongodb to other user in the container?
I would like to mount the directory SOME_PATH_ON_HOST into container and the user of this directory is USER. When the service started, it shows permission error. Can I change the user or permission of /data/db in container to USER instead of create a mock user mongodb on the host?
I am using docker stack to deploy my services. Kindly see my docker-compose.yml below:
version: '3.2'
services:
db:
image: mongo
volumes:
- "SOME_PATH_ON_HOST:/data/db"
environment:
- MONGO_INITDB_DATABASE=example_db
deploy:
replicas: 1
Is it possible to change the user name from
mongodbto other user in the container?I would like to mount the directory
SOME_PATH_ON_HOSTinto container and the user of this directory isUSER. When the service started, it shows permission error. Can I change the user or permission of/data/dbin container to USER instead of create a mock user mongodb on the host?I am using docker stack to deploy my services. Kindly see my
docker-compose.ymlbelow: