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

CreateContainerCmd#withPortBindings and other deprecated methods #1281

Closed
zysaaa opened this issue Nov 25, 2019 · 4 comments
Closed

CreateContainerCmd#withPortBindings and other deprecated methods #1281

zysaaa opened this issue Nov 25, 2019 · 4 comments

Comments

@zysaaa
Copy link

zysaaa commented Nov 25, 2019

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.

@EHJ-52n
Copy link

EHJ-52n commented Mar 19, 2020

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?

@KostyaSha
Copy link
Member

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

@EHJ-52n
Copy link

EHJ-52n commented Mar 19, 2020

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

@bsideup bsideup changed the title CreateContainerCmd#withPortBindings、withPrivileged Deprecated? CreateContainerCmd#withPortBindings and other deprecated methods May 18, 2020
@bsideup bsideup pinned this issue May 18, 2020
@bsideup
Copy link
Member

bsideup commented May 18, 2020

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 👍

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

No branches or pull requests

4 participants