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.

all 7 comments

sorted by: hot top controversial new old
[–] 19 points 2 months ago (1 child)

Is your user in the docker group? That group can run docker commands without sudo.

  • source
  • hideshow 1 child comment
  • [–] 7 points 2 months ago (4 children)

    The question has been answered. But since you seem to be new to containers, I'll just give you a recommendation. Just use podman. It can do pretty much everything that docker is used for, but it's rootless by default.

  • source
  • hideshow 4 child comments
  • [–] 2 points 2 months ago (2 children)

    Question since you seem to know more than the average, is Podman not harder to set up? It's part of what has held me off from it, because I've heard it's more difficult to achieve things with it than Docker. Is that wrong?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 2 months ago* (1 child)

    For most "normal" setups, no. Networks, environment variables, volumes, permissions etc. map pretty much one-to-one.

    If you're using compose, you can even keep your setup mostly unchanged and use podman compose. Although, I would recommend learning a bit about quadlets and using them instead. There's a tool called podlet that can help you translate your docker commands to quadlets, although it's not complete and does miss some features. The annoying thing can be some QoL tooling that exists for docker compose that doesn't for quadlets e.g. automatic restart for changed quadlet files. I wrote some scripts for most of these situations. I will probably release them at some point after I make sure that they don't rely on any specific properties of my setup. But you can easily write them for yourself if you know some shell scripting.

    For docker run commands, you can mostly get away with changing it to podman run.

  • source
  • parent
  • hideshow 1 child comment