On agent start : "Error response from daemon: 400 Bad Request: malformed Host header"

Hey, folks.

I’ve been using RancherOS nodes as VMs for my experimentation and just this morning I decided to give my local workstation a try.

I get this when I try to start rancher/agent:

➜ ~ sudo docker run -ti --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.0.1 http://localhost:8080/v1/scripts/7E1B3B7754062FA12ABF:1461088800000:jQodlZauxaM3du4KRtR0Oga6Rs
Error response from daemon: 400 Bad Request: malformed Host header%

Note that I’ve stripped off the ‘-d’ option so I could see the error message.

dockerd is running on Ubuntu 16.04 fully-patched. Here’s the output of ‘docker version’:

➜  ~ docker version
Client:
  Version:      1.10.3
  API version:  1.22
  Go version:   go1.6
  Git commit:   20f81dd
  Built:        Mon, 11 Apr 2016 14:15:45 +1200
  OS/Arch:      linux/amd64

Server:
 Version:      1.10.3
 API version:  1.22
 Go version:   go1.6
 Git commit:   20f81dd
 Built:        Mon, 04 Apr 2016 16:27:28 +1200
 OS/Arch:      linux/amd64

According to this GH Issue, this might be related to Golang runtime’s handling of the Host header when the docker client is talking to the dockerd:

When I login to my rancher VMs and check the output of ‘docker version’ I see an older version of Docker running against the Golang 1.5 runtime.

Any ideas?

It sounds like these are Docker errors as there is also this issue with Ubuntu 16.04.

1 Like

Docker reverted this and compiles releases with 1.5 because it broke older clients, but Ubuntu 16.04 is packaging a version with their own patches that was compiled with Go 1.6.

Thanks for the info, folks.

Confirming that when I uninstalled the docker.io package from Ubuntu and installed the docker-engine package from the official Docker apt repo things are now working as expected.

I can confirm that the problem is present in Archlinux too. They use go 1.6.2 in their docker package.