How to handle if deleting /var/run/docker.sock by mistake

Yesterday, when I trying to find out how to deploy Gitea action runner locally, I read the official document and it says:

You may notice that we have mounted the /var/run/docker.sock into the container. It is because the act runner will run jobs in docker containers, so it needs to communicate with the docker daemon. As mentioned, you can remove it if you want to run jobs in the host directly. To be clear, the “host” actually means the container which is running the act runner now, instead of the host machine.

I misunderstand As mentioned, you can remove it if you want to run jobs in the host directly. So I just run the following:

1
rm /var/run/docker.sock

It is really funny. Then my docker is broken. I have searched on google and try to figure it out how to repair. Simply restart docker service using service docekr restart did not work. Finally, I find the correct answer:

1
2
3
systemctl stop docker
systemctl restart docker.socket
systemctl start docker

Well, everything comes back!

Reference

  1. https://forums.docker.com/t/i-accidentally-deleted-the-docker-sock-what-can-i-do/138074