Skip to content

CreateContainerCmd#withPortBindings and other deprecated methods #1281

Closed

Description

@zysaaa

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.

Activity

  1. EHJ-52n commented on Mar 19, 2020

    @EHJ-52n

    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?

  2. KostyaSha commented on Mar 19, 2020

    @KostyaSha
    Member

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

  3. EHJ-52n commented on Mar 19, 2020

    @EHJ-52n

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

  4. changed the title [-]CreateContainerCmd#withPortBindings、withPrivileged Deprecated?[/-] [+]CreateContainerCmd#withPortBindings and other deprecated methods[/+] on May 18, 2020
  5. pinned this issue on May 18, 2020
  6. bsideup commented on May 18, 2020

    @bsideup
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions