On my server, I’ve noticed that I can run docker commands like docker compose up -d or docker run hello-world without root (sudo, su, etc), as if I had done the rootless setup, but docker info reveals “context: default”. I am also not using userns-remap. Any theories for what’s going on here?

Edit: [Solved] @cosmicrose@lemmy.blahaj.zone pointed out that users in the docker group can run commands without sudo, after checking, my user is indeed in the group.

  • groet@feddit.org
    link
    fedilink
    arrow-up
    8
    ·
    1 day ago

    Just as a security note: being in the docker group allows root access. If your user is not already a sudoer anyway, they can get root through docker.

    So if you run malicious code (like running a bad install script from the wrong github repo or installing the wrong dependency) as that user the attacker can escalate to root without knowing the user password.

    (The trick is to create a container and mount /. Then you can edit whatever files you want inside of the container, like editing /etc/passwd and setting a known password for the root user)