Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublishAllPorts behavior seems to have changed in remote API 1.14 #7869

Closed
ivey opened this issue Sep 3, 2014 · 15 comments
Closed

PublishAllPorts behavior seems to have changed in remote API 1.14 #7869

ivey opened this issue Sep 3, 2014 · 15 comments
Labels

Comments

@ivey
Copy link

ivey commented Sep 3, 2014

With docker 1.11, a POST to /containers/$id/start with {"PublishAllPorts": true} would start the container and bind exposed ports as expected.

After upgrading to 1.12, the container no longer binds any ports.

API docs show no changes in this area - did something change, or is this a regression?

@thomassuckow
Copy link

I am also having trouble with the PortBindings option not exposing any ports.

@docwhat
Copy link

docwhat commented Sep 5, 2014

This is also probably the cause of jenkinsci/docker-plugin#90

@mastef
Copy link

mastef commented Sep 5, 2014

Same problem in Shipyard

@crosbymichael
Copy link
Contributor

ping @tiborvass Do you mind looking into this tomorrow if it is a regression?

@tiborvass
Copy link
Contributor

@crosbymichael of course. Thanks!

@jessfraz
Copy link
Contributor

jessfraz commented Sep 5, 2014

I can recreate, looking into it

@jessfraz
Copy link
Contributor

jessfraz commented Sep 5, 2014

@ivey @docwhat @thomassuckow

CORRECTION: I cannot reproduce, sorry for the confusion.

I tested with v1.11, v1.12, v1.13, and v1.14 of the API.
I tested with a Dockerfile that exposed a port and an API request to /container/create that passed ExposedPorts , then started the container with PublishAllPorts. It worked on all versions.

Then tested building and creating/starting an image on docker version 1.1.2, and upgrading docker tp 1.2.0 and running start via the api, and cannot reproduce that way either.

Can you give some insight into the requests you are passing to the API for build, create, start, etc. Thanks!

@tiborvass
Copy link
Contributor

@LK4D4 @erikh @unclejack if any of you can reproduce this please let us know!

@thomassuckow
Copy link

In the jenkins plugin case, it appears to be using PortSpecs instead of ExposedPorts. The docker API is not well documented IMO, so I am not completely sure if those options are trying to accomplish the same thing.

@thomassuckow
Copy link

I am seeing behaviour where:

POST /containers/.../start

With any of the following

{"PortBindings":{"6900/tcp":[{}]}}
{"PortBindings":{"6900/tcp":[{"HostIp":"0.0.0.0"}]}}
{"PublishAllPorts":true}

Results in:

..., "Ports":{"6900/tcp":null}}, ...

@tiborvass
Copy link
Contributor

@thomassuckow can you please paste the output of docker version and docker info ?

@thomassuckow
Copy link

$ docker -H ... version
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.2.2
Git commit (client): d84a070/1.1.2
Server version: 1.2.0
Server API version: 1.14
Go version (server): go1.3.1
Git commit (server): fa7b24f
$ docker -H ... info
Containers: 51
Images: 155
Storage Driver: btrfs
Execution Driver: native-0.2
Kernel Version: 3.15.8+

I am still trying to track down the issue. I am working to recreate the (mostly) exact request as the docker client sends it (which works).

Docker client sends (works):

POST /v1.13/containers/.../start HTTP/1.1
Host: ...
User-Agent: Docker-Client/1.1.2
Content-Length: 239
Content-Type: application/json
Accept-Encoding: gzip

{"Binds":null,"ContainerIDFile":"","LxcConf":[],"Privileged":false,"PortBindings":{"6900/tcp":[{"HostIp":"0.0.0.0","HostPort":""}]},"Links":null,"PublishAllPorts":false,"Dns":null,"DnsSearch":null,"VolumesFrom":null,"NetworkMode":"bridge"}

My modified jDocker library sends (does not work):

POST /containers/.../start HTTP/1.1
Content-Type: application/json
User-Agent: Jersey/2.5.1 (HttpUrlConnection 1.6.0_32)
Host: ...
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Transfer-Encoding: chunked

d1
{"Binds":null,"ContainerIDFile":"","LxcConf":[],"PortBindings":{"6900/tcp":[{"HostIp":"0.0.0.0","HostPort":""}]},"Privileged":false,"PublishAllPorts":false,"Dns":null,"VolumesFrom":null,"NetworkMode":"bridge"}
0

@thomassuckow
Copy link

The issue is Transfer-Encoding: chunked. Something is not handling that correctly for the start command and thus the HostConfig provided is ignored.

@sfitts
Copy link

sfitts commented Sep 10, 2014

Confirmed that this is also causing #6231. FWIW, this is easy to reproduce using the docker-java API binding. For us this is a breaking issue so we've backed our Docker installation off to 1.1.1.

@jessfraz
Copy link
Contributor

jessfraz commented Oct 1, 2014

closing as half is fixed by #7927 and the other half is a duplicate of #6231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants