A container collects code and all its dependencies to ensure a smooth and quick transition of applications from one computing environment to another. A
/var/run/docker.sock
/var/run/docker.sock
is basically the Unix socket the Docker daemon listens on by default. It is also a tool used to communicate with the Docker daemon from within a container. Sometimes, containers need to /var/run/docker.sock
file.
The image shows how container can access the features of docker daemon without being part of the interface itself.
By default, a Docker daemon on a Docker platform listens on the /var/run/docker.sock
Unix socket. This is verified by the fact that the options provided in daemon contain the following entry.
-H unix:///var/run/docker.sock
-H options is provided so that the daemon listens on tcp host/port or on other unix sockets.
Mounting the Docker daemon socket gives the control of the daemon to the container. However, this process should only be used with trusted containers when necessary.
Let’s look at the events that may occur in this process: