dongmi4035 2018-11-25 19:01
浏览 102
已采纳

用于Golang的Docker SDK无法连接到覆盖网络内部的守护程序

I have a docker swarm, and a container inside of an overlay network on that swarm. The container has an app written in golang that interacts with the Docker API by creating a container and starting it. When I run my golang app on the host machine, everything runs perfect and it creates and runs the container without issue. However when I put the app into the container and run it in my overlay network, it no longer can reach the API.

I'm assuming this has something to do with networking, but the idea of my project is that there are multiple services, each with their own networks, that can create, launch, and remove containers they see fit. NOT running the SDK in an app outside of the overlay networks unfortunately is not an option at this time.

Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

  • 写回答

1条回答 默认 最新

  • dongye9071 2018-11-25 19:10
    关注

    Your app is trying to access the Docker socket, but this is not accessible by default in the container.

    You can mount it as a volume from the host: -v /var/run/docker.sock:/var/run/docker.sock

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?