docker concept for DBA-part-2 Run docker for non-privileged user (Other than root)

You need to change group to docker for user (non-privileged user) otherwise you get following error:-

[user@debasiseric1 ~]$ docker images
 Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get //%2Fvar%2Frun%2Fdocker.sock/v1.37/images/json: dial unix /var/run/docker.sock: connect: permission denied
Now I will login to root
sudo su -

cd /var/run

[root@debasiseric1 run]# ls -al docker.sock
 srw-rw---- 1 root docker 0 Apr 7 07:33 docker.sock
docker is the group which own docker.sock
[root@debasiseric1 run]# id -a user
 uid=1001(user) gid=1001(user) groups=1001(user),10(wheel)
Now add to the group to docker now
[root@debasiseric1 ~]# usermod -aG docker user

[root@debasiseric1 ~]# id -a user
 uid=1001(user) gid=1001(user) groups=1001(user),10(wheel),988(docker)
Now you will be able to run docker command from user
[user@debasiseric1 ~]$ docker images
 REPOSITORY TAG IMAGE ID CREATED SIZE

 

0 comments on “docker concept for DBA-part-2 Run docker for non-privileged user (Other than root)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>