Allow to send empty messages in StartContainerCmd#111
Merged
marcuslinke merged 2 commits intodocker-java:masterfrom Dec 11, 2014
Merged
Allow to send empty messages in StartContainerCmd#111marcuslinke merged 2 commits intodocker-java:masterfrom
marcuslinke merged 2 commits intodocker-java:masterfrom
Conversation
This illustrates an issue with current docker-java: you cannot send a StartContainerCmd without payload.
Any payload sent with the StartContainerCmd will cause the target
container to lose its customization.
So in order to just start a preconfigured container you must be able to
send an empty "{}" message to the /containers/{id}/start endpoint.
This is accomplished by all configuration defaulting to null in
combination with @JsonInclude(NON_EMPTY).
marcuslinke
added a commit
that referenced
this pull request
Dec 11, 2014
Allow to send empty messages in StartContainerCmd
Contributor
|
@albers Thanks! Merged. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is something special about starting a container via
POST /containers/(id)/start:If the posted message body is not empty, any previous container customization will be reset to its defaults.
To illustrate, here are two variants of creating a container with custom DNS and then starting it.
Because docker-java currently includes lots of parameters in its
StartContainerCmdImpl, there is no way to just start a preconfigured container, see the newly addedStartContainerCmdImplTest.existingHostConfigIsPreservedByBlankStartCmd()that fails with the current implementation.This PR solves the issue by introducing a notion of undefinedness for all parameters and ignoring all empty parameters when serializing.
Thus,
dockerClient.startContainerCmd(container.getId()).exec()will send{}as message body.