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 as different user than root? #89

Open
Tofandel opened this issue Aug 1, 2023 · 3 comments
Open

Run as different user than root? #89

Tofandel opened this issue Aug 1, 2023 · 3 comments

Comments

@Tofandel
Copy link

Tofandel commented Aug 1, 2023

I run docker compose as an user other than root and to avoid filesystem permissions issues on my mounted files I change the user and group id to match the user running docker

smtp:
        image: mwader/postfix-relay
        restart: always
        user: 1000:1000
        volumes:
            -  ./data/dkim:/etc/opendkim/keys

Unfortunately the image fails to run with another user than root /bin/bash: /root/run: Permission denied

@wader
Copy link
Owner

wader commented Aug 1, 2023

Hey, yeah /root/run is probably own by root by default, we can probably change permission etc on it but i guess the problem with running as non-root is how to know which uid/gid to use? it there any convention for it? could it be done optionally? not sure i have much time to look into it atm but feel to research it or propose something

@Tofandel
Copy link
Author

Tofandel commented Aug 1, 2023

It's a very big and large problem in docker this volume permissions but unfortunately they are not doing anything about it

So right now we have to use hacks and bake gosu into the image entrypoint to achieve that

It can be made optional with an env var, since it will still run as root but execute the entrypoint as the specified user with the GID and UID taken from a file in a mounted volume

@wader
Copy link
Owner

wader commented Aug 1, 2023

Yeap that is my experience with it also, is a mess. Wonder if it would be possible in the postfix-relay case to generate config files with uid/gid to use? maybe postfix supports it? no idea.

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

2 participants