You are currently viewing What Is Docker Rootless And How To Install Rootless Docker?

What Is Docker Rootless And How To Install Rootless Docker?

Docker has revolutionized the way we package, distribute, and run applications. It’s an invaluable tool for developers, system administrators, and organizations. However, as Docker evolved, so did concerns about security, especially when running Docker as the root user. To address these concerns, Docker introduced “rootless” mode, offering a more secure way to run containers without the need for root privileges.

In this comprehensive guide, we’ll explore Docker’s rootless mode, exploring what it is, why it’s essential, how to set it up, and its advantages and limitations. As the leading experts in Docker consulting services, we‘ve provided this detailed blog. Whether you’re an experienced Docker user or just starting your containerization journey, this guide will help you understand and harness the power of Docker without the associated security risks.

Understanding Docker Rootless

Before we dive into the nitty-gritty details, let’s establish a foundational understanding of Docker rootless mode.

What Is Docker Rootless?

Docker rootless mode is a security feature that allows you to run Docker containers without requiring root (superuser) privileges. In traditional Docker installations, the Docker daemon runs with root access, which can potentially pose security risks. With rootless mode, Docker operates in a more secure manner, reducing the attack surface and providing better isolation between the host and containers.

Rootless Docker relies on a Linux kernel feature called user namespaces, which was introduced in kernel version 3.8. User namespaces provide a way to isolate privileges and separate user identities across processes. In the context of Docker, user namespaces allow you to map a range of user IDs so that the root user within a container maps to an unprivileged range in the parent namespace.

Docker has been able to use user namespaces for some time, thanks to the –userns-remap option. However, there was a limitation: the runtime engine still ran as the root user, which didn’t fully solve the security problem. This is where rootless Docker comes in to address this issue.

Read more: Our Blog Post On docker restart policy

Why Is Rootless Mode Essential?

Docker running in rootless mode has the following benefits:

  • Enhanced Security: By removing the need for root access, Docker rootless mode significantly reduces the security risks associated with container escapes and unauthorized access to the host system.
  • Isolation: Rootless containers are more isolated from the host system, preventing potential interference with critical system components.
  • User Privileges: Users who don’t have root privileges can still leverage the power of Docker, making it accessible to a broader range of users.
  • Parallel Docker Instances: Docker rootless mode enables multiple users to run their Docker instances concurrently without conflicts.

Now that we’ve established the importance of Docker rootless mode, let’s move on to its advantages and disadvantages.

Advantages of Docker Rootless

Now that you have Docker rootless mode up and running, you might be wondering about its benefits.

1. Improved Security

The most significant advantage of Docker rootless mode is the enhanced security it provides. By avoiding the need for root access, you reduce the risk of container escapes and unauthorized access to the host system. This is particularly important in multi-tenant environments and when dealing with untrusted container images.

2. User Isolation

Rootless containers offer better isolation from the host system. They operate within user namespaces, preventing potential conflicts and interference with system components. This isolation is essential for maintaining a secure and stable host environment.

3. Accessibility for Non-Root Users

Docker rootless mode opens up Docker’s capabilities to users who don’t have root privileges. This is especially valuable in scenarios where you want to provide containerization capabilities to a broader user base without compromising security.

4. Concurrency

In a rootless Docker setup, multiple users can run their Docker instances concurrently. This parallelization is useful for scenarios where different users or applications need their isolated Docker environments without conflicts.

Disadvantages of Docker Rootless

While Docker rootless mode offers numerous advantages, it’s important to be aware of its limitations:

1. Compatibility

Not all Docker features and container images are compatible with rootless mode. Some Docker features may not work as expected or may require additional configuration.

2. Performance Overhead

Running Docker in rootless mode may introduce a slight performance overhead due to the additional layers of user namespace and security features. While this overhead is generally minimal, it’s something to consider in resource-intensive use cases.

3. Complex Setup

Setting up Docker rootless mode can be more complex and requires additional configurations compared to traditional Docker installations. Users may need to familiarize themselves with user namespaces and system-specific settings.

Setting Up Docker Rootless

Configuring Docker rootless mode involves several steps, but fear not – we’ll guide you through the process.

How to Install Rootless Docker

To begin, download the rootless Docker installation script from the official website using the following command:

curl -sSL| sh

Next, open the .bashrc file and include the following environmental variables:

export PATH=/home/Suser/bin: $PATH
export DOCKER_HOST=unix:///run/user/Sid/docker.sock

Ensure you replace $user with the Linux username for which you are installing Docker and replace $id with the user’s ID code.

  1. After making these replacements, save the changes to the file and exit.
  2. Proceed to start the rootless Docker daemon.

Configure User Namespace

Docker rootless mode relies on user namespaces, a Linux kernel feature that provides a way to map user and group IDs in containerized processes to different user and group IDs on the host system. The user namespace setup is an essential prerequisite for rootless Docker.

You can configure user namespaces by modifying your system’s /etc/subuid and /etc/subgid files. These files define which user and group IDs are allowed to be remapped within user namespaces. You can do this manually or by using tools like usermod or useradd.

Start Docker in Rootless Mode

To initiate Docker in rootless mode, you need to create a dedicated Docker daemon for your user. Here’s how you can do it: install

This script will guide you through the setup process and create the necessary configurations. Once completed, you can start the Docker daemon: start

Set Up Docker CLI

To use Docker rootless mode effectively, you need to configure your Docker CLI to communicate with the rootless Docker daemon. This involves setting environment variables in your shell profile. The exact variables may vary depending on your system and setup, so refer to the official Docker documentation for guidance.

Run Containers

With Docker rootless mode set up, you can now run containers as a non-root user. The process is the same as with traditional Docker, but you won’t need to use sudo or have root privileges.

Read more: Our Blog Post On docker logs tail

Things you should know

Start/Stop Container

To start or stop the Docker daemon, you can use the familiar systemctl command, but you’ll need to append the –user flag after the command.

systemctl --user stop docker 
systemctl --user start docker

Connect from Client

To connect to the Docker daemon from the client, there are multiple methods available. The most common approach is using the command line interface, but you can also utilize Docker Desktop. Additionally, there are various software development kits (SDKs) available in different programming languages to interact with Docker.

In the case of using rootful Docker, you typically don’t need to set the DOCKER_HOST environment variable explicitly because it is already configured. However, when transitioning to rootless Docker, you may need to specify this environment variable when you intend to connect to the Docker host.

You can find the value of the DOCKER_HOST environment variable using the following string: [Insert the string or method for retrieving the DOCKER_HOST value].



Docker rootless mode is a significant step forward in enhancing the security and accessibility of Docker. It allows users to enjoy the benefits of containerization without the need for root privileges. While it comes with certain limitations and complexities, the advantages it offers, particularly in terms of security and user isolation, make it a valuable addition to the Docker ecosystem.

Through this blog, we’ve guided you with comprehensive insights into rootless Docker, enabling you to streamline your Docker usage with ease. By following the steps outlined in this guide, you can set up Docker rootless mode on your system and start running containers with confidence. As containerization technologies continue to evolve, Docker rootless mode stands out as a security-conscious choice for both individuals and organizations. 

If you have any doubts or facing any issues you can connect with us for expert guidance and support with Docker-related challenges. Feel free to reach out to our Docker consulting services. We’re here to help you make the most of containerization technology and solve your problems at any time. Whether you’re a developer, sysadmin, or security-conscious user, Docker rootless mode is a tool worth exploring to strike the right balance between usability and security in your containerized environments.

Related Articles