To run Docker without sudo in Linux is quite simple. Using your terminal in Linux and a couple simple commands shown below. You don’t need to be an expert Linux guru software developer to go thru these steps.
If you don’t want to preface the docker
command with sudo
, create a Linux group called docker
and add users to it. When the Docker daemon starts, it creates a Unix socket accessible by members of the docker
group.
Create the docker group:
sudo groupadd docker
Add your user to the docker group:
sudo usermod -aG docker $USER
Log out and log back to activate the group membership in Linux or you can run:
newgrp docker
Now, verify you can run docker without sudo:
docker ps
docker run hello-world
That is all! Super simple, anybody can do it. Now go brew better coffee at home. Contact me using the comments below or shoot me an email using my contact page.