-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running MongoDB entrypoint as non-root user #315
Comments
You just need to allow permissions for the user in the container, so you could mount the $ mkdir db && sudo chown 777 db
$ docker run --rm -dit -v $PWD/db:/data/db -v /etc/passwd:/etc/passwd:ro --user 1000:1001 --name mongo mongo
6c4a4e74b314a2a01893bc0b7405106db3100db37e9ad466772f56f2f88ec2b2
$ echo $UID
1000
$ docker exec -it mongo bash
groups: cannot find name for group ID 1001
rei@6c4a4e74b314:/$ echo $UID
1000 |
@wglambert is correct; we have had arbitrary user support since #81, but then the operator running the container is in charge of providing a data directory that the chosen user can access. The percona, postgres, mariadb, and mysql images have the same issue. |
Thanks @wglambert. You are right. I had to set the volume on the host to be writable by the user:group I was using and it worked!
Thanks for the help. Closing. |
Use case: As a sys admin, I need to run a MongoDB Docker container with a custom "approved" service account. This is company IT policy.
Today, the mongodb Docker container starts up the
docker-entrypoint.sh
as root and spins upmongod
running as mongodb user, which is created at image build time.Trying to use a custom
--user user:group
fails as the file system permissions are not good.Can you provide instructions or a Dockefile with support for such a requirement?
The text was updated successfully, but these errors were encountered: