在有些 docker compose 文件中看到下面这样的配置,比如 Docker Flow Proxy stack 的 docker-compose-stack.yml :
swarm-listener:
image: vfarcic/docker-flow-swarm-listener
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- DF_NOTIFY_CREATE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/reconfigure
- DF_NOTIFY_REMOVE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/remove
deploy:
placement:
constraints: [node.role == manager]
请问 /var/run/docker.sock 的用途是什么?
在 About /var/run/docker.sock 这篇博文中找到了答案:
It’s the unix socket the Docker daemon listens on by default and it can be used to communicate with the daemon from within a container.
