Docker-java: CreateContainerCmd#withPortBindings and other deprecated methods

Created on 25 Nov 2019  路  4Comments  路  Source: docker-java/docker-java

I am using 3.1.5 version. and I want to do port binding like :
docker run -d -p 5555:5000 training/webapp python app.py
And i find CreateContainerCmd#withPortBindings is deprecated, Which API can replace this?
I have the same doubt about withPrivileged, which is also deprecated.

typquestion

Most helpful comment

If you see a method deprecated on CreateContainerCmd, you should be setting it on HostConfig (set/accessed via withHostConfig()/getHostConfig()).
The deprecated methods were just shortcuts and did not match Docker's API.

If someone is up to contributing, a @deprecated see {#withHostConfig()} comment sounds like a low hanging fruit 馃憤

All 4 comments

From my point of view, the reason for deprecation and which alternative to use should be documented, too.

For example, there are many methods in com.github.dockerjava.api.command.CreateContainerCmd deprecated but no documentation at all.

Is there any source of documentation that can be used for providing this javadoc?

everything that "proxy" hostconfig methods are deprecated, use hostconfig directly

Thanks for clarifying this. Is this documented somewhere in the class and I missed it?

If you see a method deprecated on CreateContainerCmd, you should be setting it on HostConfig (set/accessed via withHostConfig()/getHostConfig()).
The deprecated methods were just shortcuts and did not match Docker's API.

If someone is up to contributing, a @deprecated see {#withHostConfig()} comment sounds like a low hanging fruit 馃憤

Was this page helpful?
0 / 5 - 0 ratings