Hello Friend, Its Maulana
Today we want to try Run Docker Commands without Sudo
as we know that when we want to run docker we need use sudo
Here, I try some docker syntax but got eror :
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "
http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json": dial unix /var/run/docker.sock: connect: permission denied
but we cant solve it using sudo.
In some cases, we doesnt want to put sudo every time.
so, lets fix it.
- First, create the docker to group
sudo groupadd docker
- then add usermod
sudo usermod -aG docker [user_name]
- enable the new settings
su - [user_name]
- lastly, check to confirm that the user is now part of the docker group
id -nG
- Now, we can try without sudo
Yeaayyy, Now we can run docker commands without sudo
thanks guys, that's all for today and see you laterrr....