I am looking for a solution for a rootless Docker instance on a machine that is already running regular Docker. Ideally, lower privileged users that do not have root access could then still use the "Rootless" Docker
There are a bunch of guides on how to install "rootless" Docker, but I haven't really found anything on the compatibility of these two. The official Docs recommend uninstalling any running Docker instance or disabling it. Can you actually have both working separately on the same server?
At least on Ubuntu 22.04 it seems I'm able to run both rootful and rootless Docker in parallel without issues. I set up rootless Docker as described on https://rootlesscontaine.rs/getting-started/docker/ and https://docs.docker.com/engine/security/rootless/ :
dockerd-rootless-setuptool.sh install
systemctl --user start docker.service
Notably, I did not run
sudo systemctl disable --now docker.service docker.socket
I.e. if I execute sudo systemctl status docker.service docker.socket
and systemctl status --user docker.service
, I see two Docker daemons running in parallel. Now, to choose which Docker daemon should be used, I either set
export DOCKER_HOST="unix:///var/run/docker.sock" # rootful
or
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock" # rootless
in my local .envrc.
The two daemons appear to work completely independently of each other as expected, i.e. image cache, running containers (docker ps
), etc. are all separate.
Disclaimer: One thing I have yet to test are more elaborate container network setups, e.g. when running rootful & rootless docker compose
in parallel. I usually don't do that, though, so for now I'm happy.