I accidentally deleted the docker.sock. What can I do?

/var/run/docker.sock

Stop the Docker daemon, restart the docker socket and start the docker daemon

systemctl stop docker
systemctl restart docker.socket
systemctl start docker

Somehow you could also create a socket file manually, but I donā€™t think that would be automatically used even with the same name.

Stopping Docker is important before restarting the socket, otherwise the socket will be used even though that is not on the filesystem anymore, and a new folder would be created with the same name which you have to delete manually. I know this because I tried, but Iā€™m not saying I understand why.

1 Like