How to make docker commands available to normal user

Docker command can only be run the root user or by a user in the docker group by default. If any normal user tries to execute those commands, it will fail with the following error.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create": dial unix /var/run/docker.sock: connect: permission denied.

To resolve this problem, add the user to the docker group.

Step1: Login to the shell as root

Step2: Add the required user to docker group.

#usermod -aG docker USER

Where USER need to be replaced with the name of the required user.

That's all…