Skip to content

Handle network aliases without a custom network gracefully - #1942

Merged
eddumelendez merged 2 commits into
docker-java:masterfrom
aidando73:feature/issue-with-network-aliases
Sep 13, 2022
Merged

Handle network aliases without a custom network gracefully#1942
eddumelendez merged 2 commits into
docker-java:masterfrom
aidando73:feature/issue-with-network-aliases

Conversation

@aidando73

Copy link
Copy Markdown
Contributor

Fixes #1940

if (containerNetwork != null) {
if (containerNetwork != null && hostConfig.getNetworkMode() != null) {
networkingConfig = new NetworkingConfig()
.withEndpointsConfig(singletonMap(hostConfig.getNetworkMode(), containerNetwork));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception was being thrown as we were putting:

EndpointsConfig: {
    null: containerNetwork
}

as networkMode is null by default. This can't be serialised by JSON so it throws.

@eddumelendez eddumelendez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just waiting for @bsideup review

Comment thread docker-java/src/test/java/com/github/dockerjava/cmd/CreateContainerCmdIT.java Outdated

@bsideup bsideup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a nit 👍

@aidando73

Copy link
Copy Markdown
Contributor Author

Thank you @eddumelendez and @bsideup for the review. I've addressed your suggestions.

@bsideup bsideup added this to the next milestone Sep 13, 2022
@eddumelendez
eddumelendez merged commit a961200 into docker-java:master Sep 13, 2022
@eddumelendez

Copy link
Copy Markdown
Member

Thanks for your contribution @REslim30 !

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) when using network aliases

3 participants