-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Docker Swarm Service Container : Capability prefixed with CAP_ cannot be deserialized (InvalidFormatException) #1980
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
Comments
there is another issue related to missing values and as you can see those were addressed. The report didn't mention any
This is related to the data being sent to docker server for which docker-java doesn't use the prefix. I would like to understand the behavior first between the swarm usage reported and without it. Not saying is a bug on docker swarm but I think some consistency would be appreciated :) |
Thanks for the quick response @eddumelendez I will take a look at the swarm settings to see if there is an option to change the inspect response, clearly there does appear to be an inconsistency as you stated. When the container is started locally, we don't see the problem, it is only when it is deployed as a swarm service that the exception occurs. Here is the
Here is the
|
I have temporarily worked around this issue in my application code-base by implementing a wrapper that implements the DockerClientConfig interface and delegates to the actual DefaultDockerClientConfig object; this pattern allows the application to create its own ObjectMapper mapper and control its deserializer configuration. There are three solutions that I considered (listed below). For the record, I selected option 2. mainly because of its simplicity and the fact that our application doesn't need the Capability value, so replacing it with a null is OK:
and
I think one of these solutions should be baked into docker-java code-base. |
@armband have you considered opening an issue on https://github.com/moby/moby ? |
btw, docker daemon only validates that the capability is the right one. It doesn't remove or add anything. So, if |
I have also looked into this; it might be that compose (which version are you using @armband) behaves differently for swarm and local mode and specifically adds However, since Docker will transparently set
as well, I think |
@armband are you willing to contribute with option 3? |
The docker-compose version we are using is fairly recent : v2.11.2
I have not, but can. It may be an inconsistency they can address, but I feel the behavior is acceptable based on the wording of their documentation.
Of course, I would be happy to contribute. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@armband Did you have any time to look into contributing the change? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is is now very relevant for Docker version 28 (released a few hours ago), which includes this PR: moby/moby#48551 |
Docker: version 20.10.18, build b40c2f6
docker-java:3.2.8
Description
We have a service deployed to a Docker Swarm, using docker-compose to set the IPC_LOCK capability, as follows:
Calling the docker-java
InspectContainerCmdImpl
to inspect the container on the node to which the service task has been deployed fails and produces the following exception:Based on the documentation, Docker uses a capability name with/without the CAP_ prefix interchangeably:
https://docs.docker.com/engine/reference/run/
This does not appear to be a Docker / Docker swarm bug. Can the CAP_ prefix be automatically stripped to prevent the deserialization issue?
Thanks
The text was updated successfully, but these errors were encountered: