2019-07-01 12:08

Docker Engine API-通过对等方重置连接

  • docker

I'm trying to make requests to the Docker API remotely.

I have the docker engine running on virtual machine, and I'm making the requests from docker containers.

Firstly, I've done this to make the Docker daemon listen on a specific IP and port:

edit /lib/systemd/system/docker.service 
ExecStart=/usr/bin/docker -H fd:// -H=tcp://
systemctl daemon-reload
sudo service docker restart

I configured to listen on, so it will be reachable at any IPv4 address.

When I test this via curl on host, it works fine. e.g: curl localhost:5555/services

However, my goal is to make requests from containers. Here is how I construct the docker client inside my go program:

cli, err := client.NewClientWithOpts(
if err != nil {

networkFilters := filters.NewArgs()
networkFilters.Add("driver", "overlay")
networks, err := cli.NetworkList(context.Background(), types.NetworkListOptions{Filters: networkFilters})
if err != nil {

The error I'm having:

http: panic serving error during connect: Get read tcp> read: connection reset by peer

Any ideas? Thanks

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享