-
-
Notifications
You must be signed in to change notification settings - Fork 4
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 container as non-root user #314
Comments
Yes it is. I tested it on my end and it should work. You just need to ensure the user you use has access to both the You should be able to use it like this: services:
nautical-backup:
image: minituff/nautical-backup:2
container_name: nautical-backup
user: 1000:1000 # <--- override default `root` user
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /config:/config
- /source:/app/source
- /destination:/app/destination
environment: # Optional variables
- TZ=America/Los_Angeles
- CRON_SCHEDULE=0 4 * * *
- SKIP_CONTAINERS=example1,example2,example3 Let me know if this works for you. I can also update the docs so everyone else knows that it's supported. |
Thanks. I just tried it and it doesn't seem to work. I'm getting some permission denied errors. Perhaps what I'm wanting is not supported by this simple change. I want A few of the containers I run create appdata owned by other users (including root), sometimes with restrictive permissions (
|
Hmm, yeah I checked again and I am also seeing those permissions errors. I can fix this error This error I was able to fix those issues but I uncovered another one. The Docker socket Also, the |
Yeah, my knowledge is limited but I think the benefit of passing On the other hand, Ultimately, most containers don't need to run as root but something like a backup tool is different. There will very often be situations where you're backing up files not owned by a specific user or with restrictive permissions. However, maybe there are lots of things the container can just run as non-root? It feels safe to assume that I'd love to hear thoughts in general about best practices for running containers that often required elevated privileges whilst also maintaining security. |
Is it possible to run the container as a non-root user, specifically I want to run it as my host user either by passing
PUID
andPGID
env vars or withuser: 1000:1000
.The text was updated successfully, but these errors were encountered: