DEV Community

David Tio
David Tio

Posted on • Edited on • Originally published at blog.dtio.app

How to Install Docker Rootless on Ubuntu (2026 Guide)

How to Install Docker Rootless on Ubuntu (2026 Guide)

Quick one-liner: Run Docker without sudo — safer, simpler, and no system-wide changes.


Why This Matters

I still remember the first time I saw a developer accidentally break a production server. They ran docker rm -f with a wildcard, and because Docker was running as root, it deleted system containers too. The entire server went down.

That's why I now install Docker in rootless mode by default.

Think of it like a seatbelt — you don't need it until you do. Rootless Docker means:

  • Your containers can't touch system files
  • No sudo required for daily operations
  • Damage is contained if something goes wrong

You asked, I delivered: This guide was the #1 request in my LinkedIn poll (Ubuntu / Linux Mint won with 57% of votes).


Prerequisites

  • Ubuntu 22.04 or higher (also works on Linux Mint, Pop!_OS)
  • Basic terminal familiarity (copy-paste commands)
  • 5 minutes of your time

Step 1: Install Dependencies

First, update your package list and install the required tools:

sudo apt update
sudo apt install -y curl ca-certificates fuse uidmap
Enter fullscreen mode Exit fullscreen mode

What we're installing:

  • curl — Downloads the Docker installation script
  • ca-certificates — Verifies secure connections
  • fuse — Allows user-space filesystem access (needed for rootless)
  • uidmap — Enables user namespace mapping (security isolation)

Step 2: Download the Rootless Docker Script

Docker provides an official installation script for rootless mode:

curl -fsSL https://get.docker.com -o get-docker.sh
Enter fullscreen mode Exit fullscreen mode

Verify the download:

ls -lh get-docker.sh
Enter fullscreen mode Exit fullscreen mode

You should see a file around 20-25KB in size.


Step 3: Run the Installation Script

Execute the script with the --rootless flag:

sh get-docker.sh --rootless
Enter fullscreen mode Exit fullscreen mode

What happens:

  • Downloads Docker binaries to ~/.docker/rootless
  • Sets up a user-specific systemd service
  • Configures network namespaces

Expected output (last few lines):

Created symlink /etc/systemd/user/default.target.wants/docker.service → /usr/lib/systemd/user/docker.service.
Created symlink /etc/systemd/user/sockets.target.wants/docker.sock → /usr/lib/systemd/user/docker.sock.
Docker rootless mode installed successfully.
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure Your Shell

Add Docker to your PATH so you can run it without the full path:

echo 'export PATH=/home/$USER/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

For Zsh users:

echo 'export PATH=/home/$USER/bin:$PATH' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Step 5: Start Docker

Start the Docker daemon for your user session:

systemctl --user start docker
Enter fullscreen mode Exit fullscreen mode

Enable Docker to start on login:

systemctl --user enable docker
Enter fullscreen mode Exit fullscreen mode

Verification

Here's how to confirm everything worked:

1. Check Docker is running:

docker ps
Enter fullscreen mode Exit fullscreen mode

Expected output:

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
Enter fullscreen mode Exit fullscreen mode

(Empty list is fine — we're just checking the daemon responds.)

2. Verify rootless mode:

docker info | grep -i rootless
Enter fullscreen mode Exit fullscreen mode

Expected output:

Rootless: true
Enter fullscreen mode Exit fullscreen mode

3. Test with a container:

docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Expected output:

Hello from Docker!
This message shows that your installation appears to be working correctly.
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

Problem: "Cannot connect to the Docker daemon"

Solution: The Docker service isn't running. Start it:

systemctl --user start docker
Enter fullscreen mode Exit fullscreen mode

If that fails, check the status:

systemctl --user status docker
Enter fullscreen mode Exit fullscreen mode

Problem: "fuse: device not found"

Solution: Install FUSE support:

sudo apt install -y fuse
Enter fullscreen mode Exit fullscreen mode

Then restart Docker:

systemctl --user restart docker
Enter fullscreen mode Exit fullscreen mode

Problem: Containers can't access the network

Solution: Rootless Docker uses user namespaces, which can conflict with some network configurations. Try:

sudo sysctl -w net.ipv4.ip_unprivileged_port_start=0
Enter fullscreen mode Exit fullscreen mode

To make this permanent:

echo "net.ipv4.ip_unprivileged_port_start=0" | sudo tee -a /etc/sysctl.conf
Enter fullscreen mode Exit fullscreen mode

What's Next

Now that Docker is running rootless, you can:

  1. Deploy your first app — Try docker run -p 8080:80 nginx
  2. Learn Docker Compose — Multi-container orchestration made simple
  3. Set up volumes — Persist your data across container restarts

Want more? I've written a full book on Docker — "Levelling Up with Docker" — with 14 chapters covering volumes, networking, Compose, and production best practices. Grab it on Amazon.


Share This Guide

Found this helpful? Share it with someone learning Docker:

Questions? Drop a comment below or reach out on LinkedIn.


Published: 4 March 2026
Author: David Tio
Tags: Docker, Ubuntu, Linux, Rootless, DevOps, Tutorial
Cross-posted to: Dev.to, Hashnode (canonical URL: fosstechnotes.blogspot.com)

Top comments (0)