What is Docker Socket?

Docker socket file is located at /var/run/docker.sock It is used to communicate with the main docker daemon (process) by default. It is the entry point for a Docker API. This socket is used by Docker CLI by default to execute docker commands. Let me show you how to change the location of the docker sock file.

Stop Docker

Firstly, if the docker service is running on your system, stop it. To confirm it has stopped, run the status command.

Edit docker.conf and docker.socket

The following, I am changing the path from /var/run/docker.sock to /home/geekflare/docker.sock

Edit the docker.conf file inside /etc/init/ directory with the new location. You just need to edit one line with DOCKER_SOCKET path.

Edit the docker.socket file located at /lib/systemd/system/ with the updated docker.sock file location.

Run the below command to update the changes (location of docker sock file).

Start Docker

Let’s start the docker service, and check the status if it got started. You will see at the end of the status log printed on the terminal will give the updated path of docker.sock file. Run the ls command at the path of docker.sock file, just to confirm that this file got created when you started the docker service. You have successfully updated the location of docker sock file. If you are looking to learn Docker but busy, then check out this crash course.

How to change Docker sock file location  - 18How to change Docker sock file location  - 12How to change Docker sock file location  - 67How to change Docker sock file location  - 38How to change Docker sock file location  - 22How to change Docker sock file location  - 39How to change Docker sock file location  - 63How to change Docker sock file location  - 40How to change Docker sock file location  - 95How to change Docker sock file location  - 2How to change Docker sock file location  - 60How to change Docker sock file location  - 84How to change Docker sock file location  - 49How to change Docker sock file location  - 28How to change Docker sock file location  - 46How to change Docker sock file location  - 40How to change Docker sock file location  - 18How to change Docker sock file location  - 83How to change Docker sock file location  - 43How to change Docker sock file location  - 13How to change Docker sock file location  - 20How to change Docker sock file location  - 62How to change Docker sock file location  - 85