After successful installation when i Try to test docker installation with sample container it give following error
Solution
Step 1 : Check docker group
if docker group does not exist create it
Step 2 : Add user to docker group
[yogesh@devBase ~]$ sudo chmod g+w /lib/systemd/system/docker.socket
Step 5 : open new terminal and restart docker. now run docker run hello-world its working perfectly.
[yogesh@devBase ~]$ systemctl start docker [yogesh@devBase ~]$ docker run test docker: 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.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied. See 'docker run --help'.
Solution
Step 1 : Check docker group
[yogesh@devBase ~]$ cat /etc/group docker:x:970:
if docker group does not exist create it
Step 2 : Add user to docker group
[yogesh@devBase ~]$ sudo usermod -aG docker ${USER}Step 3 : Above two step not solved the problem now check /lib/systemd/system/docker.socket file.
[yogesh@devBase ~]$ ls -l /lib/systemd/system/docker.socket -rw-r--r--. 1 root root 197 Mar 11 06:56 /lib/systemd/system/docker.socketif user and group of this file is root then change group to docker.
[yogesh@devBase ~]$ sudo chgrp docker /lib/systemd/system/docker.socket [sudo] password for yogesh: [yogesh@devBase ~]$Step 4 : Give permission to group
[yogesh@devBase ~]$ sudo chmod g+w /lib/systemd/system/docker.socket
Step 5 : open new terminal and restart docker. now run docker run hello-world its working perfectly.
[yogesh@devBase ~]$ ls -l /lib/systemd/system/docker.socket -rw-rw-r--. 1 root docker 197 Mar 11 06:56 /lib/systemd/system/docker.socket
No comments:
Post a Comment