# How to Configure Docker in Rootless Mode?

## Question

How to configure Docker in rootless mode?

## Environment

Container platform: **Docker**

## Answer

For better security, we recommend that you always run Docker in rootless mode. For more information about how to configure Docker in rootless mode, see [Docker documentation](https://docs.docker.com/engine/security/rootless/).

> **Important:** - Using the `xfs` filesystem for `/home` ($HOME) is highly recommended.
> - A minimum of 50GB of free disk space for `/home` is recommended.
> - Before you enable Docker in rootless mode, make sure you stop the system-wide Docker service with the following command: `sudo systemctl disable --now docker.service docker.service`
> - The Docker rootless binaries will be available in the `$HOME/bin` folder.
> - Amazon Linux 2 does not support Docker in rootless mode. If you want to use Amazon Linux as your operating system, we recommend using the latest Amazon Linux 2023 (AL2023) x86_64 AMI.

Example steps using the docker supplied [installation](https://docs.docker.com/engine/security/rootless/#install) script (as the non-root user):

```bash
curl -fsSL "https://get.docker.com/rootless" | sh

```

The above commands should already have started the Docker service. If it has not started, do the following to enable and start it:

1. Run the following as the non-root user:

   ```bash
   systemctl --user enable --now docker.service
   systemctl --user start --now docker.service
   systemctl --user status docker.service

   ```
2. Run the following command to allow services to run even after the user logs out:

   ```bash
   sudo loginctl enable-linger <username>

   ```
