skip to Main Content

I have installed docker on rhel 8.3 from docker binaries by using command /usr/bin/dockerd & .

every month or after 2 months I get Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? this issue but meanwhile in the background my all containers & services are working only I can’t use the docker command. so in a such case, I kill dockerd process & then restart the docker daemon. is there any other solution instead of the killing process? because of this, I go through data loss issue. I also added a user in the docker group, all binaries have 777 permission as well docker.sock file also. please help me with the solution

2

Answers


  1. I had this problem, Docker was working but I couldn’t execute Docker commands.

    This was because the symlink of the docker.sock was not correct.

    The path /var/run/docker.sock points to /Users/user1/.docker/run/docker.sock instead of /Users/admin/.docker/run/docker.sock

    To solve the problem I deleted the bad symlink and recreated it correctly.

    sudo rm /var/run/docker.sock
    
    sudo ln -s /your/path/docker.sock /var/run/docker.sock
    

    make sure you change the path in the example by your actual path.

    Login or Signup to reply.
  2. Try to run all your docker commands with prefix sudo, like:

    sudo docker ps
    

    Or try below command to avoid using sudo every time, if you have are running on a Linux system or change commands accordingly

    1. Create the docker group

      sudo groupadd docker
      
    2. Add your user to the docker group.

      sudo usermod -aG docker $USER
      

    Make sure to restart your system once you run these commands.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search