Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dockerClient.inspectContainerCmd(id).exec() throws exception. version 3.5.1 #2457

@zhangyzGithub

Description

@zhangyzGithub

when i exec this ,
InspectContainerResponse inspectResponse = dockerClient.inspectContainerCmd(id).exec();

throws exception , like this.
java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of com.github.dockerjava.api.model.Ports, problem: Error parsing ExposedPort '161/udp/tcp'
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: com.github.dockerjava.api.command.InspectContainerResponse["HostConfig"]->com.github.dockerjava.api.model.HostConfig["PortBindings"])

Then, my container's info , 'HostConfig' likes this.
"HostConfig": {
"Binds": [

        ],
        "ContainerIDFile": "",
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "NetworkMode": "host",
        "PortBindings": {
            "161/udp/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "161"
                }
            ]
        },
 ......

From the error message, it can be seen that the port binding ‘161/udp/tcp’ parsing error occurred.
How to solve it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions