Skip to content
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

Should gid and uid be customizable? #96

Closed
tozz opened this issue May 9, 2016 · 5 comments
Closed

Should gid and uid be customizable? #96

tozz opened this issue May 9, 2016 · 5 comments

Comments

@tozz
Copy link

tozz commented May 9, 2016

Any reason why these aren't configurable from the host? Right now on 3.3 you get a uid of 999 for example, this is a bit annoying when you mount host folders as volumes.

@tianon
Copy link
Member

tianon commented May 9, 2016

You should be able to use docker run --user to use any arbitrary UID/GID you please; see #81 for more details.

@tozz
Copy link
Author

tozz commented May 9, 2016

That doesn't affect the Dockerfile, everything in there is still done with the wrong uid/guid.
For example
RUN mkdir -p /data/db /data/configdb \ && chown -R mongodb:mongodb /data/db /data/configdb

@yosifkit
Copy link
Member

yosifkit commented May 9, 2016

Correct, but if you are mounting a directory from the host you can control the permissions of that directory to be accessible by the --user that you specify.

@yosifkit
Copy link
Member

yosifkit commented May 9, 2016

It should be something like this:

me@host$ mkdir mongo-data
# also make a configdb directory if you need one
me@host$ id -u
1000
me@host$ docker run -d -v "$PWD/mongo-data:/data/db" --user 1000 mongo
# or 
$ docker run -d -v "$PWD/mongo-data:/data/db" --user "$(id -u)" mongo

@tozz
Copy link
Author

tozz commented May 10, 2016

Yes, sorry for wasting you guys time, I was under the impression that 0644 on the host directory was enough of a permission but it actually needs to be 0744.

@tozz tozz closed this as completed May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants