Improve adding of port bindings by albers · Pull Request #87 · docker-java/docker-java
added 4 commits
October 31, 2014 14:58The use of Ports for adding port bindings requires knowledge of the internal data structure used for storing port bindings in Docker API. This commit adds a more intuitive alternative that works like the --publish option of the Docker CLI and some builder methods like withBinds(Bind...) and withLinks(Link...).
This allows you to use textual port binding specifications in the format
used by the Docker CLI in docker-java:
StartContainerCmd.withPortBindings(PortBinding.parse("80:8080/tcp"));
In Docker API, an undefined IP address is expressed as "". This is not intuitive and should be hidden from the user. Likewise, docker-java uses 0 for an unspecified port number. This also is not intuitive, especially if you consider that 0 is a legal port number. This change makes the undefinedness explicit by using null in both cases. When serializing, "" is used instead of null. This implies changing the type of hostPort from int to Integer.
albers added a commit to albers/docker-build-step-plugin that referenced this pull request
Nov 4, 2014marcuslinke added a commit that referenced this pull request
Nov 5, 2014albers added a commit to albers/docker-build-step-plugin that referenced this pull request
Nov 5, 2014This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters