Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Servers, nginx and Docker

dockerd-rootless-setuptool.sh refuses to install while rootful Docker is present

Your error

[ERROR] Aborting because rootful Docker (/var/run/docker.sock) is running and accessible. Set --force to ignore.

Fix it fast

Most common cause, 1 of 3

The system-wide Docker daemon is still running

Stop and disable the service and its socket unit, remove the socket file, and repeat the install without sudo.

Fix
sudo systemctl disable --now docker.service docker.socket
sudo rm /var/run/docker.sock
dockerd-rootless-setuptool.sh install
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Aborting because rootful Docker (/var/run/docker.sock) is running and accessible comes from dockerd-rootless-setuptool.sh when your user can write to the system socket. Disable docker.service and docker.socket, remove /var/run/docker.sock, then rerun the install. To keep both daemons, pass --force and switch between them with docker context use. Docker Engine 29 on Ubuntu 24.04.

  • Applies to Docker Engine 29.10, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Check the two systemd units and the socket file. Which of them is still there tells the causes apart.

Run this first
systemctl is-active docker.service docker.socket
ls -l /var/run/docker.sock
test -w /var/run/docker.sock && echo "writable for $(id -un)"

Then find the line you see in this list and open its fix:

  1. 1The system-wide Docker daemon is still runningsystemctl reports docker.service as active
  2. 2The daemon is stopped, but the socket file is still theredocker.service is inactive, yet ls still shows /var/run/docker.sock and the writable test prints a line
  3. 3You want rootless and rootful Docker side by sideYou need the system daemon for other users or services, so disabling it is not an option

What does the error look like?

  • [ERROR] Aborting because rootful Docker (/var/run/docker.sock) is running and accessible. Set --force to ignore.

Cause 1 of 3

The system-wide Docker daemon is still running

You seesystemctl reports docker.service as active

Check

The rootless installer aborts on rootful Docker because the normal, root-owned daemon is still up and you can reach its socket. Docker's rootless guide tells you to disable that daemon before you install, and to remove its socket file.

Check
systemctl status docker.service --no-pager

Fix

Stop and disable the service and its socket unit, remove the socket file, and repeat the install without sudo.

Fix
sudo systemctl disable --now docker.service docker.socket
sudo rm /var/run/docker.sock
dockerd-rootless-setuptool.sh install

Verify

The installer ends by creating and selecting the rootless context, and docker info names it.

Verify
docker info | grep -E 'Context|rootless'

Confirmed by docs.docker.com

Did this fix it?

Cause 2 of 3

The daemon is stopped, but the socket file is still there

You seedocker.service is inactive, yet ls still shows /var/run/docker.sock and the writable test prints a line

Check

The setup tool reports rootful Docker even with the daemon stopped, because its check never asks a daemon anything. In the script the abort runs whenever /var/run/docker.sock is writable for you and --force is not set, so a socket file kept by an active docker.socket unit, or one simply left behind, is enough.

Check
systemctl is-active docker.socket; systemctl is-enabled docker.socket

Fix

Disable the socket unit as well, delete the file it left, and start the install again.

Fix
sudo systemctl disable --now docker.socket
sudo rm -f /var/run/docker.sock
dockerd-rootless-setuptool.sh install

Verify

The writable test from the first step prints nothing, and the installer gets past the check.

Verify
test -w /var/run/docker.sock || echo 'no rootful socket'

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 3 of 3

You want rootless and rootful Docker side by side

You seeYou need the system daemon for other users or services, so disabling it is not an option

Check

The abort message on rootful Docker is a guard, not a hard limit. Docker's guide says that if you keep the system service and socket you must pass --force, and that until you disable them you are still running rootful Docker as well.

Check
dockerd-rootless-setuptool.sh --help

Fix

Install with --force. The tool creates a CLI context called rootless and selects it; switch back to the system daemon with the default context whenever you need it.

Fix
dockerd-rootless-setuptool.sh install --force
docker context use rootless   # your own daemon
docker context use default    # the system daemon

Verify

docker context ls lists both contexts, and docker info shows rootless under Security Options while the rootless context is selected.

Verify
docker context ls
docker info | grep -A6 'Security Options'

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Decide per machine whether Docker runs rootful or rootless, and disable docker.service and docker.socket on rootless-only hosts.
  • Run sudo loginctl enable-linger for the rootless user, as the installer prints, so the daemon survives logout and reboot.
  • Script the switch with docker context use instead of exporting DOCKER_HOST by hand.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: TaxiDex, Dispatch Pro.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.