GithubHelp home page GithubHelp logo

Running as root about docker HOT 5 CLOSED

sinusbot avatar sinusbot commented on July 24, 2024
Running as root

from docker.

Comments (5)

irgendwr avatar irgendwr commented on July 24, 2024 2

Aren't you discouraging people to run it as root?

Yes, because it's good practice in general.

What is the reason for running the Sinusbot as root? This is the official docker image of it, isn't it?

Running a service inside a docker container as root is not the same as running a service on your "real" server as root. In this case the SinusBot is only running as root inside the docker container. The container is (mostly) isolated from your actual server.

One could argue that even though the container is isolated you should still run the service with as few permissions as possible. That's true but makes things a bit more complicated.

We're using volumes for the scripts and data folder, if we change something then the volumes might not be writable. (haven't looked into this though, not sure but it's not that simple)

If you have a solution then feel free to make a pull request. ^^

If users wants to run the container properly with as few permissions as possible: They have the possibility to do it already.
They can use dockers --userns-remap ... or --user ... flags/parameters to set the user. You will however need to change the ownership of the volumes accordingly.

from docker.

Xuxe avatar Xuxe commented on July 24, 2024 2

Aren't you discouraging people to run it as root?

Yes, because it's good practice in general.

What is the reason for running the Sinusbot as root? This is the official docker image of it, isn't it?

Running a service inside a docker container as root is not the same as running a service on your "real" server as root. In this case the SinusBot is only running as root inside the docker container. The container is (mostly) isolated from your actual server.

One could argue that even though the container is isolated you should still run the service with as few permissions as possible. That's true but makes things a bit more complicated.

We're using volumes for the scripts and data folder, if we change something then the volumes might not be writable. (haven't looked into this though, not sure but it's not that simple)

If you have a solution then feel free to make a pull request. ^^

If users wants to run the container properly with as few permissions as possible: They have the possibility to do it already.
They can use dockers --userns-remap ... or --user ... flags/parameters to set the user. You will however need to change the ownership of the volumes accordingly.

As @irgendwr said it's more up to the admin to configure a privilege downgrade e.g remapping the user ids: https://docs.docker.com/engine/security/userns-remap/
https://kubernetes.io/docs/concepts/policy/pod-security-policy/#users-and-groups

I don't recommed to change things like this if you have already running containers, you will destroy all volumes with it, because as already said you have to remap the uids.

Dropping the privileges with a "default" user inside the dockerfile is a "work a round" to make it secure by default but this may colides with other user ids on the host. I may use the id 1000 inside the dockerfile and have an existing user on the host with id 1000 and extended privileges. I think you get it, it's may a mess if you have running containers with a user id of a host user.

But we should take a note inside the docs/install instructions about this topic @irgendwr .

from docker.

irgendwr avatar irgendwr commented on July 24, 2024

A majority of docker images run as root in their container, including the official TeamSpeak image.

from docker.

gimicze avatar gimicze commented on July 24, 2024

Yes, many docker images run as root, but I don't see a reason here as there is another Sinusbot docker image which doesn't run it as root. And don't get me wrong, I was just curious and it's not that much of a problem. I may have a look at it sometime.

from docker.

irgendwr avatar irgendwr commented on July 24, 2024

Yep, previous versions of the sinusbot would refuse run as root in docker-containers but we decided that in that case it would make sense to add an exception.

I'm leaving this issue open for now and we'll probably look into it sometime.
The only thing that worries me is that users will need to change ownership of the volumes which will probably lead to people complaining that their docker container is no longer working/"has a bug".
Dunno, we'll see.

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.