Ever Wondered How to Run Dapr with Docker in Rootless Mode? Wonder No More!
In general, it’s recommended to run Docker in rootless mode due to security reasons. Rootless Docker enhances security by minimizing the privileges needed to run containers, which reduces the risk of potential security vulnerabilities.
Introduction
Running Docker in rootless mode is an essential move for improving security, as it limits the potential attack surface by not requiring root privileges. However, Dapr, a popular distributed application runtime, has some compatibility issues when running in this mode as it references to the default docker runtime only. This blog post will guide you through the steps to fix these issues and get Dapr up and running with Docker in rootless mode.
Applying the Fix
To get Dapr running smoothly with Docker in rootless mode, follow these steps:
- Install Rootless Docker:
Make sure you have rootless Docker installed. You can follow the official Docker documentation for instructions on setting up rootless Docker. - Install Dapr CLI:
Download and install the Dapr CLI by following the instructions on the Dapr documentation. - Add Symlink for Rootless Docker Installation:
For the rootless Docker installation, run the following code snipped to create a symbolic link for the Docker socket:
sudo apt install jq
docker_endpoint_rootless=$(docker context ls --format json | jq -r 'select(.Name=="rootless") | .DockerEndpoint' | sed 's/unix:\/\///')
sudo mv /var/run/docker.sock /var/run/docker.sock.bkp
sudo ln -s $docker_endpoint_rootless /var/run/docker.sock
- Initialize Dapr:
After making these changes, initialize Dapr to ensure it picks up the new Docker configuration, it should now start up normally.
dapr init
Testing the Installation
Once you’ve applied the above steps, it’s time to test your setup. Simply run docker ps
to verify that the following Docker containers are running, these are used for the Dapr sidecar.

Reaching Out
If you found this article useful, stay tuned as we regularly publish technical articles all around microservices development among other topics. Follow us on LinkedIn to be notified of the next article.
If you are looking for help on microservices development for the smart factory of tomorrow, book a free initial assessment or drop us an e-mail at [email protected].
Until next time.