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

run containers as host user #7

Open
asherp opened this issue Aug 31, 2021 · 8 comments
Open

run containers as host user #7

asherp opened this issue Aug 31, 2021 · 8 comments

Comments

@asherp
Copy link
Collaborator

asherp commented Aug 31, 2021

Adding user: ${user} to a docker-compose service will allow you to run a service with the host's username. This allows files created within the container to have the same permissions as the host. This would resolve issues with not being able see the contents of mounted volumes.

@asherp
Copy link
Collaborator Author

asherp commented Sep 4, 2021

Found this recommendation courtesy of the manim community:

For Linux users there might be permission problems when letting the user in the container write to the mounted volume. Add --user="$(id -u):$(id -g)" to the docker CLI arguments to prevent the creation of output files not belonging to your user.

@rsafier
Copy link
Member

rsafier commented Sep 9, 2021

doesn't work, because the containers themselves won't have the local user, have it a try and its a hot mess.

@RandyMcMillan
Copy link
Member

There is a way to do it but yeah... it would take a big lift...
Maybe a medium/long term goal...

@RandyMcMillan
Copy link
Member

RandyMcMillan commented Sep 9, 2021

https://github.com/RandyMcMillan/docker.shell
This repo has an implementation of a user pushed to the container for reference.

@RandyMcMillan
Copy link
Member

Do we still want to do this?

@rsafier
Copy link
Member

rsafier commented May 15, 2022

I am not super concerned with it, but it writing out files as root can be confusing for users that don't have firm understanding of permissions under a non-root under Linux, so it is still probably worth doing (tho would hate to bust any existing that upgrade and now the container cannot read the mapped files they originally were written as root on host system)
Seems the OSX defaults just give non-root users access to those files anyways so they never notice a difference.

@RandyMcMillan
Copy link
Member

I will mess around with a config that defaults to root but allows for a user=user_name option.

@RandyMcMillan
Copy link
Member

i know how to do this... i will take another look since I am doing some work on the playground...

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