问题原文
原帖链接 · r00tusr · CC BY-SA 4.0
After reading some articles I'm still not sure about what user I should use to run a docker container. Are there any security concerns when running a docker container as root user? Is it ok to run docker containers as root user OR should I use my normal user, add him to the "docker" group and then run my containers OR should I create an additional user only for managing/creating docker containers?
root@myDockerHost:/opt/myDockerContainer# docker-compose up -d
VS
chris@myDockerHost:/opt/myDockerContainer# docker-compose up -d
VS
dockerusr@myDockerHost:/opt/myDockerContainer# docker-compose up -d
(I'm talking about the users on my docker host - not the user inside a container!)
社区高分解答
原帖链接 · Mike Diehn · CC BY-SA 4.0
r00tusr!
I vote for always running containers as regular users.
In a production system your containers won't be run as root. Even in non-production systems, the users who run your container might not be allowed to run programs as root.
So I like to make them work properly as an unprivileged user, even when it's difficult.
Also, there's the security consideration. The general rule professional sysadmins follow is never to run something as root unless it really, really must. Once a program is running as root, it has full control of the computer and can do anything to that computer that it is told to do. Whether that be the good works the author intended or nefarious works by a neer-do-well who cracks into the author's program through a vulnerability that author didn't think to close.
Since we've finally learned that we really, truly cannot predict which programs have flaws, we just don't take chances anymore.
Thanks! Mike
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
