Title: GitHub · Where software is built
Open Graph Title: docker-java/docker-java
X Title: docker-java/docker-java
Description: Java Docker API Client. Contribute to docker-java/docker-java development by creating an account on GitHub.
Open Graph Description: Java Docker API Client. Contribute to docker-java/docker-java development by creating an account on GitHub.
X Description: Java Docker API Client. Contribute to docker-java/docker-java development by creating an account on GitHub.
Opengraph URL: https://github.com/docker-java/docker-java
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot deserialize value of type `com.github.dockerjava.api.model.Capability`","articleBody":"**OS**: Ubuntu 22.04.5 LTS\n**Docker version**: 28.1.0\n**Docker Compose version**: v2.34.0\n**Docker-java version**: 3.5.0\n\n🐞 **Issue**\nWhen inspecting a Docker container using the docker-java client, I encounter the following exception:\n\n```\njava.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `com.github.dockerjava.api.model.Capability` from String \"CAP_DAC_READ_SEARCH\": not one of the values accepted for Enum class: [ALL, SYS_BOOT, DAC_OVERRIDE, NET_RAW, BLOCK_SUSPEND, FOWNER, IPC_LOCK, IPC_OWNER, SYS_PACCT, NET_BIND_SERVICE, WAKE_ALARM, FSETID, DAC_READ_SEARCH, SYS_CHROOT, AUDIT_READ, SYS_RAWIO, SYS_ADMIN, KILL, MAC_ADMIN, SYS_RESOURCE, CHOWN, PERFMON, SETPCAP, SYS_PTRACE, NET_ADMIN, SETFCAP, SYS_NICE, LINUX_IMMUTABLE, BPF, AUDIT_CONTROL, LEASE, AUDIT_WRITE, SYS_MODULE, MKNOD, SYSLOG, MAC_OVERRIDE, SYS_TIME, SETGID, SETUID, CHECKPOINT_RESTORE, SYS_TTY_CONFIG, NET_BROADCAST]\nThis occurs when deserializing the CapAdd field from InspectContainerResponse.\n```\n\n📄 **Example Code**\n\n```\npublic Object inspectContainer(String containerName) {\n String containerId = getCurrentIdForContainer(containerName);\n return dockerClient.inspectContainerCmd(containerId).exec();\n}\n```\n🔍 **Analysis**\nThe deserialization fails because Docker returns capabilities with the CAP_ prefix (e.g., CAP_DAC_READ_SEARCH), but the Capability enum in docker-java omits that prefix (e.g., DAC_READ_SEARCH).\n\nAccording to the Docker capabilities [documentation](https://man7.org/linux/man-pages/man7/capabilities.7.html) and types.go, Docker capabilities are typically listed with the CAP_ prefix.\n\nThe Capability enum here: https://javadoc.io/static/com.github.docker-java/docker-java/3.0.6/index.html?com/github/dockerjava/api/model/Capability.html\n\n...does not align directly with the string values Docker returns.\n\n✅ **Suggested Fix**\nCould the enum Capability be enhanced to:\n\nSupport @JsonCreator to allow aliasing/deserialization of names with the CAP_ prefix?\n\nOr alternatively, normalize the incoming capability strings before deserialization?\n\nThis would improve compatibility when parsing real-world Docker API responses, and prevent failures like the one above.","author":{"url":"https://github.com/rzabson2","@type":"Person","name":"rzabson2"},"datePublished":"2025-04-25T10:51:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/2432/docker-java/issues/2432"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:467d411e-3da9-6627-ce55-2b3d4bf3536b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6E6:BB87C:686041C:8E420C6:69735C6B |
| html-safe-nonce | 4f7a385f1a4188faf23e4127c93bdb7f8e13fe7bf74411694955a3cf7c1e55a2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkU2OkJCODdDOjY4NjA0MUM6OEU0MjBDNjo2OTczNUM2QiIsInZpc2l0b3JfaWQiOiI4MjUyMzY2MDIxMzIyODI0ODExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | db3e779a57be3e15494e9058d6c2c2c9a85a5bd7a30315f77e9b4878bc692dee |
| hovercard-subject-tag | repository:20415251 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/docker-java/docker-java/issues/2432 |
| twitter:image | https://opengraph.githubassets.com/c31f8f3e9151e9dea251a341382fab712b1321247b850f978eba3fb0478f364d/docker-java/docker-java |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c31f8f3e9151e9dea251a341382fab712b1321247b850f978eba3fb0478f364d/docker-java/docker-java |
| og:image:alt | Java Docker API Client. Contribute to docker-java/docker-java development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4cf879a11b0a28a85543899a36aaee9ec9ca2fb7bedad86c0da5731193c95f01 |
| turbo-cache-control | no-cache |
| go-import | github.com/docker-java/docker-java git https://github.com/docker-java/docker-java.git |
| octolytics-dimension-user_id | 7772003 |
| octolytics-dimension-user_login | docker-java |
| octolytics-dimension-repository_id | 20415251 |
| octolytics-dimension-repository_nwo | docker-java/docker-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20415251 |
| octolytics-dimension-repository_network_root_nwo | docker-java/docker-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fe8be790582ef7a55477ce1918ac0ed16b106d31 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width