-
Notifications
You must be signed in to change notification settings - Fork 156
Engine-api built with Go(<=1.4) won't work with Docker daemon built with Go(>=1.6) #189
Comments
See moby/moby#20865 |
@duglin Yeah, I saw that one. :) I think in moby/moby#20865, people were mainly talking about the Docker CLI. While this one is just talking about the engine-api, which is a little different:
|
I do agree with @Random-Liu, maybe we should handle this in here too. |
Thanks, @vdemeester! BTW, we are switching from go-dockerclient to this official engine-api, :). There is no such problem in go-dockerclient (See here) |
We have control of the default client, so we should be able to handle it. Is there a way uses of |
Explicitly setting the value to something meaningful and valid should be easy enough to do. A PR would be welcome.... |
@duglin Thanks, I'll send a PR soon :) |
Fixed by #190. |
When using engine-api built with Go(<=1.4) with Docker daemon built with Go(>=1.6), it keeps complaining
"Error response from daemon: 400 Bad Request: malformed Host header"
.I think the reason is that:
request.Host
orrequest.URL.Host
(if the former is empty) (See here)unix:///var/run/docker.sock
), engine-api will setrequest.Host=""
,request.URL.Host="/var/run/docker.sock"
(See set request.URL.Host and set request.Host)request.Host
andrequest.URL.Host
to "". Then the HTTP Host header will be "". (See net/http: does not verify validity of Host header golang/go#11206))"/var/run/docker.sock"
. It will break Go 1.6 http server side validation in 1. because'/'
is not a valid character, causing400 Bad Request: malformed Host header
.I could fix this by set some random but valid thing like "docker.sock" in the
request.URL.Host
. If it is not used for unix endpoint, why don't we just set it to a valid Host?Hope this could be fixed, thanks! :)
More information kubernetes/kubernetes#23809
The text was updated successfully, but these errors were encountered: