I need to run two instances of docker on the same Ubuntu 22 (or 24) server. I know this is possible via e.g. [this URL] and [this URL] 1 2
The first dockerd is already running via the default Ubuntu install and settings.
To start the 2nd, I use the command:
sudo dockerd \
-H unix:///var/run/docker-extra.sock \
--pidfile=/var/run/docker-extra.pid \
--config-file=/etc/docker/daemon-docker-extra.json \
--iptables=true \
--ip-masq=true \
--bridge=none \
--exec-root=/var/run/docker-extra
I really want to use bridge=docker1 but cannot create docker1 until the daemon is up, so I use bridge=none for now and will create the new bridge when the Daemon is up (will this work?). I also have a config file at /etc/docker/daemon-docker-prod.json
{
"data-root": "/home/docker_extra_root_dir"
}
However, when I run the command I get continuous errors, e.g:
ERRO[2025-11-07T13:16:01.197165973Z] failed to process event container=cfbc653d38e16cc8236e4d965c7cfd47378644e1d9dc7a63a62d6d92d573ea40 error="could not find container cfbc653d38e16cc8236e4d965c7cfd47378644e1d9dc7a63a62d6d92d573ea40: No such container: cfbc653d38e16cc8236e4d965c7cfd47378644e1d9dc7a63a62d6d92d573ea40" event=exit event-info="{cfbc653d38e16cc8236e4d965c7cfd47378644e1d9dc7a63a62d6d92d573ea40 ca38900f5c5eee3f19dc2ef562865bc4fce22b3753762ed7e81209285b7d8a8834502 0 2025-11-07 13:16:01.19664609 +0000 UTC <nil>}" module=libcontainerd namespace=moby
If I look up the container IDs in the errors, I see they are actually containers that the 1st daemon is running! How does the 2nd daemon even know those exist? Why is it trying to mess with them? I thought the data-root setting in the json should ensure the two daemons don’t know about each other. Is there another setting I need to change?
I validated the json config OK, and the other daemon has json config that just says "hosts": ["fd://"] . Any advice welcome.