GuidesStart hereRootless Docker

Run containers rootless with Docker on Debian 13

Docker Engine in rootless mode on Debian 13, with a dedicated user, Compose services, port 80, a weekly update timer and a simple backup, all tested on a Melonslab server.

Tested on Docker Engine 29.10.1, Docker Compose 5.8.1, rootlesskit 3.3.0 and slirp4netns 1.2.1 on Debian 13 (trixie) on a Melonslab server Updated November 28, 2026

Recommended server for this guide

SSD RAID 1 · ECC DDR4 · 10 Gbit

VC-P Alloy · 2 vCPU · 8 GB Memory · 60 GB Storage

Month to month, no lock-in 7-day money-back guarantee

€8.99/mo

Deploy now

Quick install on a fresh VM

This command sets up a rootless container engine and a directory for this service. Podman is the default; add --engine docker to the command to use Docker instead.

curl -fsSL https://www.melonslab.com/install/rootless.sh | bash -s -- --app rootless-docker
View the script

SHA-256: 97785be3e3e91393181a4a7caeab5f4b52803bf52e960dd488945cb38c6473a2

Run this guide on Melonslab

We ran every step below on our own server. For this workload we recommend VC-P Alloy at €8.99/mo. Order it, pick Debian 13, and follow the guide.

  1. 1. Order the server. Use the button below to order the recommended plan. Choose Debian 13 when the installer asks for an operating system.
  2. 2. Add IPv4 if needed. Add it on the order form when the guide publishes a service on the internet. It is a paid add-on, not included in the plan.
  3. 3. Connect over SSH. Log in as root with the address and credentials from your order, then run the commands below.
  4. 4. Follow the verified steps. Every command in this guide was run on a Melonslab server before it was published.
Deploy now
On this page

What you will set up

Docker can run its daemon as an ordinary user. Root inside a container is then that user outside it, so a container breakout gets no more rights on the server than the account running it.

Here is what we measured on a fresh Melonslab VC-P Alloy (2 vCPU, 8 GB) with Debian 13:

  • The rootless daemon used 81 MB of memory after setup; a small traefik/whoami container used 2.7 MiB while answering requests.
  • That container's image was 11 MB, and it answered on port 80 after 3 seconds from an empty Compose project, with the image already downloaded.
  • The container came back by itself after a reboot.
  • A weekly systemd timer ran docker compose pull and docker compose up -d without errors.

This is the base for the Docker versions of the app guides. The app commands inside a container are the same as in the Podman guides; the differences are in the daemon, the Compose files and the update timer.

Before you start

You need a server with Debian 13 and root access. If it is new, secure it first.

Docker's rootless mode needs user namespaces, slirp4netns and fuse-overlayfs. All are available in Debian 13 or Docker's own repository.

1. Install Docker

apt update
apt install -y ca-certificates curl gnupg uidmap dbus-user-session fuse-overlayfs slirp4netns iptables systemd-container
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian trixie stable" > /etc/apt/sources.list.d/docker.list
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

The install starts a rootful daemon. Stop it; you will not use it:

systemctl disable --now docker.service

2. Let the user bind port 80

Linux reserves ports below 1024 for root. Docker's rootlesskit can publish them once the kernel allows it:

echo "net.ipv4.ip_unprivileged_port_start = 80" > /etc/sysctl.d/50-unprivileged-ports.conf
sysctl --system

This covers IPv6 too. Our test answered on http://127.0.0.1/ after the setting was applied.

3. Create a user for the containers

Use a user with its own group. Do not add it to the docker group: that group can talk to the rootful daemon.

useradd -m -s /bin/bash -U dockerrun
loginctl enable-linger dockerrun

enable-linger starts the user's services at boot without anyone logging in.

4. Install rootless Docker

Run the setup tool as that user, with the user's session environment. The uid is looked up so the same block works for any user:

uid=$(id -u dockerrun)
runuser -u dockerrun -- env HOME=/home/dockerrun XDG_RUNTIME_DIR=/run/user/$uid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
  dockerd-rootless-setuptool.sh install
runuser -u dockerrun -- env XDG_RUNTIME_DIR=/run/user/$uid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
  systemctl --user enable docker.service

The tool writes ~/.config/systemd/user/docker.service and a rootless CLI context. Check that it really is rootless:

uid=$(id -u dockerrun)
runuser -u dockerrun -- env HOME=/home/dockerrun XDG_RUNTIME_DIR=/run/user/$uid \
  DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
  docker info --format '{{.SecurityOptions}}'

The output should contain name=rootless. If the daemon is still bound to /var/run/docker.sock, the context is wrong; set DOCKER_HOST as above.

5. Run an app with Compose

Put each app in its own directory under the user's home. This example uses a small server that prints the request it received:

mkdir -p /home/dockerrun/whoami
cat > /home/dockerrun/whoami/compose.yaml <<'YAML'
services:
  whoami:
    image: traefik/whoami:v1.10
    ports:
      - "80:80"
    restart: unless-stopped
YAML
chown -R dockerrun:dockerrun /home/dockerrun/whoami

Start it as the user, from the directory holding the Compose file. Docker Compose resolves relative paths from the current directory; running it from /root will fail with a permission error.

uid=$(id -u dockerrun)
runuser -u dockerrun -- env HOME=/home/dockerrun XDG_RUNTIME_DIR=/run/user/$uid \
  DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
  bash -lc 'cd /home/dockerrun/whoami && docker compose pull && docker compose up -d'
curl -fsS http://127.0.0.1/

6. Share one Caddy

Only one process can bind ports 80 and 443. Give Caddy its own user, the same rootless Docker setup, and one Compose project that all app guides can point at:

useradd -m -s /bin/bash -U caddy
loginctl enable-linger caddy
caddyuid=$(id -u caddy)
runuser -u caddy -- env HOME=/home/caddy XDG_RUNTIME_DIR=/run/user/$caddyuid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$caddyuid/bus PATH=/usr/bin:/bin \
  dockerd-rootless-setuptool.sh install
runuser -u caddy -- env XDG_RUNTIME_DIR=/run/user/$caddyuid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$caddyuid/bus PATH=/usr/bin:/bin \
  systemctl --user enable docker.service
mkdir -p /home/caddy/caddy
cat > /home/caddy/caddy/Caddyfile <<'FILE'
:80 {
  respond "Hello from rootless Docker Caddy"
}
FILE
cat > /home/caddy/caddy/compose.yaml <<'YAML'
services:
  caddy:
    image: caddy:2.11.9
    container_name: caddy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - ./data:/data
      - ./config:/config
    restart: unless-stopped
YAML
chown -R caddy:caddy /home/caddy/caddy

Start it as caddy:

caddyuid=$(id -u caddy)
runuser -u caddy -- env HOME=/home/caddy XDG_RUNTIME_DIR=/run/user/$caddyuid \
  DOCKER_HOST=unix:///run/user/$caddyuid/docker.sock PATH=/usr/bin:/bin \
  bash -lc 'cd /home/caddy/caddy && docker compose pull && docker compose up -d'
curl -fsS http://127.0.0.1/

The caddy:2.11.9 image was 92 MB and answered on port 80 in our test. Automatic HTTPS needs a real DNS name and port 443; that was not part of this test. Replace the example Caddyfile with a reverse_proxy block for each app guide, then restart as caddy with docker compose restart caddy from /home/caddy/caddy.

7. Start at boot

The daemon starts at boot because of loginctl enable-linger. restart: unless-stopped in the Compose file starts the container when the daemon comes back. We rebooted the test server and the container was answering again:

runuser -u dockerrun -- env HOME=/home/dockerrun XDG_RUNTIME_DIR=/run/user/$uid \
  DOCKER_HOST=unix:///run/user/$uid/docker.sock PATH=/usr/bin:/bin \
  bash -lc 'cd /home/dockerrun/whoami && docker compose ps'

8. Update automatically

Rootless Docker has no timer like Podman's podman-auto-update.timer. Add one that pulls new images and recreates the containers:

cat > /home/dockerrun/.config/systemd/user/docker-update.service <<'UNIT'
[Unit]
Description=Update rootless Docker Compose apps

[Service]
Type=oneshot
Environment=PATH=/usr/bin
Environment=DOCKER_HOST=unix:///run/user/%U/docker.sock
WorkingDirectory=/home/dockerrun/whoami
ExecStart=/usr/bin/docker compose pull
ExecStart=/usr/bin/docker compose up -d
UNIT
cat > /home/dockerrun/.config/systemd/user/docker-update.timer <<'UNIT'
[Unit]
Description=Check for rootless Docker image updates weekly

[Timer]
OnCalendar=Sun *-*-* 04:00:00
Persistent=true

[Install]
WantedBy=timers.target
UNIT
chown -R dockerrun:dockerrun /home/dockerrun/.config

Enable it as the user and test it once:

runuser -u dockerrun -- env XDG_RUNTIME_DIR=/run/user/$uid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
  systemctl --user enable --now docker-update.timer
runuser -u dockerrun -- env XDG_RUNTIME_DIR=/run/user/$uid \
  DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$uid/bus PATH=/usr/bin:/bin \
  systemctl --user start docker-update.service

%U expands to the user's UID, so the unit does not hard-code 1001.

9. Back up

Keep the Compose file and every bind-mounted directory. With a named volume, use docker compose exec to make a dump inside the container first. For this example there is no data yet:

tar czf /root/docker-backup.tgz -C /home/dockerrun whoami

Copy the archive off the server. Restoring means unpacking it into /home/dockerrun and running docker compose up -d again.

Everyday commands

Set these two variables in the user's shell to avoid repeating them:

export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock

Then the usual commands work:

docker compose ps
docker compose logs -f
docker compose pull && docker compose up -d
docker compose down
docker stats --no-stream

Troubleshooting

docker info shows the rootful socket. The rootless context was not selected, or DOCKER_HOST is overridden. Set DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock.

Compose says stat .: permission denied. You ran it from a directory the user cannot read, usually /root. Change into the app's directory first.

Port 80 is refused. Check sysctl net.ipv4.ip_unprivileged_port_start; it must be 80 or lower.

The daemon will not start after a reboot. Check loginctl show-user dockerrun for Linger=yes, then systemctl --user status docker as the user.

The setup tool refuses because a rootful daemon is running. We stopped it in step 1. If you need the rootful daemon for something else, run dockerd-rootless-setuptool.sh install --force, but keep the rootless user out of the docker group.

Run it on your own server

SSD RAID 1 · ECC DDR4 · 10 Gbit

VC-P Alloy

€8.99/mo

vCPU
2
Memory
8 GB
Storage
60 GB
Transfer
10 TB
Performance
SSD · RAID 1
  • Full root access
  • Native /64 IPv6
  • RAID-protected storage
  • Malmö, Sweden
  • Month to month, no lock-in
  • 7-day money-back guarantee

Related comparisons and alternatives

All guides