Skip to content

Offer rootless Docker next to the system daemon - #14077

Open
c4software wants to merge 7 commits into
omacom:quattrofrom
c4software:rootless-docker-alongside
Open

c4software wants to merge 7 commits into
omacom:quattrofrom
c4software:rootless-docker-alongside

Conversation

@c4software

@c4software c4software commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Since #8056, docker needs sudo unless you opt into the docker group, which is root-equivalent. This adds a third way that keeps the protection: a rootless Docker daemon for your user, next to the system daemon rather than replacing it.

  • docker … → your rootless daemon: no sudo, no docker group, a container can only reach what your user can.
  • sudo docker … → the system daemon, unchanged: the Windows VM, the Docker TUI behind its prompt, privileged containers, existing workloads.

Nothing is migrated and the system daemon is never touched, so it's opt-in and fully reversible. It is a much smaller, opt-in alternative to #11386 (which migrates everyone to rootless) and #11032 (Podman), usable today while those are being decided.

Setup > Security > Rootless Docker

omarchy-setup-security-rootless-docker, after a confirm explaining the two daemons and the rootless limits:

  • checks the user has a subordinate UID/GID range;
  • installs rootlesskit and slirp4netns (extra) and docker-rootless-extras (AUR — Arch's docker doesn't ship upstream's rootless script and user unit, see archlinux/packaging/packages/docker#33);
  • enables linger, so the daemon and --restart containers survive logout and start at boot;
  • enables the packaged docker.service user unit (not dockerd-rootless-setuptool.sh install, whose generated unit pins PATH);
  • creates a rootless docker context and selects it. A context rather than DOCKER_HOST: plain docker picks it up, while sudo runs with root's own config and keeps reaching /var/run/docker.sock.

Why an AUR dependency

The rootless path depends on docker-rootless-extras, which is only in the AUR. Arch's docker package (extra) ships the engine and CLI but none of upstream's rootless pieces (archlinux/packaging/packages/docker#33), and the daemon cannot start without them:

  • /usr/bin/dockerd-rootless.sh, upstream's launcher that starts dockerd inside a user namespace through rootlesskit;
  • the docker.service and docker.socket user units that run it, which is what setup enables.

The package is small: no build step, its PKGBUILD downloads dockerd-rootless.sh from the moby repository at the tag matching the packaged version, checksummed, and adds the units. rootlesskit and slirp4netns come from extra.

Alternatives considered:

  • vendoring the script and units in Omarchy: the script is tied to the Docker release, so Omarchy would have to track every engine bump that the AUR package already follows;
  • dockerd-rootless-setuptool.sh install: not in Arch's docker either, and the unit it generates pins PATH.

The tradeoff is that an AUR package is not vetted like one from extra and can lag behind a docker update. It is only installed for users who opt in from Setup > Security, never by default.

Remove > Security > Rootless Docker

omarchy-remove-security-rootless-docker disables the user unit, switches back to the default context and removes rootless, and turns linger back off when setup is what turned it on (a linger the user already had is kept). Images and volumes stay in ~/.local/share/docker; it prints how to delete them (rootlesskit rm -rf, since they belong to subordinate UIDs).

The menu rows are guarded on systemctl --user is-enabled docker.service, so only the relevant one shows, like Sudoless Docker. The manual's Docker section describes the option and its tradeoffs (ports < 1024, subordinate UIDs in bind mounts, separate images).

Tests

  • test/shell.d/rootless-docker-toggle-test.sh: setup installs, enables linger and the user unit, creates/reuses and selects the context; declined, missing subuid range and already-enabled are no-ops; setup never calls system systemctl; remove restores the default context and is a no-op when off.
  • menu-test, menu-guards-test and the existing sudoless Docker tests pass. ./test/cli has one failure (vscode generated theme references current theme file) that also fails on a clean quattro.
  • Used on a real Omarchy 4.0.4 install (Docker 29.7.2, rootlesskit 3.1.0): hello-world, bind mounts owned by the user for root containers, published ports, DNS, docker build, docker compose up, --memory/--cpus limits (cgroup v2 delegation), native overlayfs on btrfs, and the system socket still refused without sudo. The menu rows were not checked visually in the running shell.

@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Adds rootless Docker setup and removal scripts with system daemon integration.

The PR appears safe to merge; no new actionable issue was established.

What we checked:

  • Existing linger stays enabled: Setup creates LINGER_MARKER only when it enables linger. Removal changes linger only when that marker exists.

Summary

Adds opt-in rootless Docker alongside the system daemon. Plain docker uses the user’s daemon; sudo docker keeps using the system daemon.

  • Setup installs the required packages, starts the user service, and selects the local rootless context.
  • Removal preserves images, volumes, and unrelated Docker contexts.
  • The latest changes track whether setup enabled linger, so removal and rollback can restore that setting.
  • All six earlier, unnumbered findings are addressed in the current code.
  • All 16 cases in rootless-docker-toggle-test.sh passed. These use stubs, not a live Docker daemon.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Setup[Enable rootless Docker] --> UserDaemon[User Docker daemon]
  Setup --> Context[Select rootless context]
  Context --> Plain[Plain docker]
  Plain --> UserDaemon
  Sudo[sudo docker] --> SystemDaemon[Existing system Docker daemon]
  Remove[Remove rootless Docker] --> Stop[Stop user daemon]
  Remove --> Default[Restore default context]
  Remove --> Linger[Restore linger when marked]
Loading

Reviews (4) · Last reviewed commit: "Turn linger back off when rootless Docke..."

@jandrusk

jandrusk commented Oct 6, 2026

Copy link
Copy Markdown

Nice, small, opt-in design, and the context-based routing that keeps sudo docker on the system daemon is clever. Since #11386 and #11032 are also open, the maintainers need to pick a direction here. One nit for whichever lands:

  • Setup runs sudo loginctl enable-linger "$USER", but neither the rollback path nor omarchy-remove-security-rootless-docker undoes it. After a remove, every user unit still starts at boot with no session. Record whether linger was already on before enabling it (loginctl show-user "$USER" -p Linger), and turn it back off on rollback/remove if setup turned it on.

Worth stating in the PR too: the rootless path depends on an AUR package (docker-rootless-extras) for the daemon's launch script and user unit.

@c4software

Copy link
Copy Markdown
Contributor Author

Good catch, fixed in 4544f71: setup now checks loginctl show-user "$USER" -p Linger and only enables linger when it was off, recording that it did. Rollback and omarchy-remove-security-rootless-docker turn it back off only in that case, so a linger the user already had is left alone. The AUR dependency on docker-rootless-extras is called out in the description under Setup.

@c4software

Copy link
Copy Markdown
Contributor Author

On the AUR dependency, I added a "Why an AUR dependency" section to the description. In short:

The rootless path depends on docker-rootless-extras, which is only in the AUR. Arch's docker package (extra) ships the engine and CLI but none of upstream's rootless pieces (archlinux/packaging/packages/docker#33), and the daemon cannot start without them:

  • /usr/bin/dockerd-rootless.sh, upstream's launcher that starts dockerd inside a user namespace through rootlesskit;
  • the docker.service and docker.socket user units that run it, which is what setup enables.

The package is small: no build step, its PKGBUILD downloads dockerd-rootless.sh from the moby repository at the tag matching the packaged version, checksummed, and adds the units. rootlesskit and slirp4netns come from extra.

Alternatives considered:

  • vendoring the script and units in Omarchy: the script is tied to the Docker release, so Omarchy would have to track every engine bump that the AUR package already follows;
  • dockerd-rootless-setuptool.sh install: not in Arch's docker either, and the unit it generates pins PATH.

The tradeoff is that an AUR package is not vetted like one from extra and can lag behind a docker update. It is only installed for users who opt in from Setup > Security, never by default.

@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

Thanks, re-checked: linger is now only turned off on rollback/remove if setup turned it on, and the AUR dependency is explained well. LGTM on the code. It overlaps #11386 and #11032, so a maintainer needs to pick a direction. The branch also has merge conflicts with quattro now and needs a rebase.

@jandrusk

jandrusk commented Oct 7, 2026

Copy link
Copy Markdown

Thanks, recording whether setup turned linger on, and only undoing it in that case, is the right shape. The "Why an AUR dependency" section helps maintainers weigh it. LGTM for whichever direction they pick.

@c4software
c4software force-pushed the rootless-docker-alongside branch from 4544f71 to 82e1cb0 Compare October 14, 2026 20:14
@omarchybot omarchybot added the enhancement New feature or request label Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants