Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Docker Instances: "Rootless" AND "Rootful" Docker on the same machine?

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?

like image 464
user23464825 Avatar asked Jun 28 '26 23:06

user23464825


1 Answers

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.

like image 138
balu Avatar answered Jun 30 '26 12:06

balu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!