Implement missing network api options for v1.22 by fbuecklers · Pull Request #484 · docker-java/docker-java
The main problem is, that the CMD is a builder and therefore should be call independent.
Let me explain the main issue i have by implementing the logic directly in the CreateContainerCmd#withLinks method.
//will correctly create links on myNet client.createContainerCmd(...) .withNetworkMode("myNet") .withLinks(...) //will faulty create links on the legacy bridge client.createContainerCmd(...) .withLinks(...) .withNetworkMode("myNet")
The issue is that the decision can't be made in the #withLinks method, because we do not know which NetworkMode is finally used.