Skip to content

Allow for null bindings#197

Merged
marcuslinke merged 1 commit intodocker-java:masterfrom
chenchun:binding
Apr 28, 2015
Merged

Allow for null bindings#197
marcuslinke merged 1 commit intodocker-java:masterfrom
chenchun:binding

Conversation

@chenchun
Copy link
Copy Markdown
Contributor

Null bindings is possible, see the following example.

chenchun:project $ docker run -d redis
0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889
chenchun:project $ docker inspect 0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889
[{
    "Args": [
        "redis-server"
    ],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "redis-server"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": [
            "/entrypoint.sh"
        ],
        "Env": [
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "REDIS_VERSION=2.8.17",
            "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-2.8.17.tar.gz",
            "REDIS_DOWNLOAD_SHA1=913479f9d2a283bfaadd1444e17e7bab560e5d1e"
        ],
        "ExposedPorts": {
            "6379/tcp": {}
        },
        "Hostname": "0efc652e829b",
        "Image": "redis",
        "Memory": 0,
        "MemorySwap": 0,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "SecurityOpt": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": {
            "/data": {}
        },
        "WorkingDir": "/data"
    },
    "Created": "2015-04-13T04:56:02.003752286Z",
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "HostConfig": {
        "Binds": null,
        "CapAdd": null,
        "CapDrop": null,
        "ContainerIDFile": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "Links": null,
        "LxcConf": [],
        "NetworkMode": "bridge",
        "PortBindings": {},
        "Privileged": false,
        "PublishAllPorts": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": ""
        },
        "VolumesFrom": null
    },
    "HostnamePath": "/mnt/sda1/var/lib/docker/containers/0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889/hostname",
    "HostsPath": "/mnt/sda1/var/lib/docker/containers/0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889/hosts",
    "Id": "0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889",
    "Image": "3ce54e911389a2b08207b0a4d01c3131ce01b617ecc1c248f6d81ffdbebd628d",
    "MountLabel": "",
    "Name": "/berserk_bell",
    "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "IPAddress": "172.17.0.6",
        "IPPrefixLen": 16,
        "MacAddress": "02:42:ac:11:00:06",
        "PortMapping": null,
        "Ports": {
            "6379/tcp": null
        }
    },
    "Path": "/entrypoint.sh",
    "ProcessLabel": "",
    "ResolvConfPath": "/mnt/sda1/var/lib/docker/containers/0efc652e829b0aca40aa70fa8000bc22837cae0cb42e26b7d3ceb8b65b65f889/resolv.conf",
    "State": {
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Paused": false,
        "Pid": 988,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2015-04-13T04:56:02.252112678Z"
    },
    "Volumes": {
        "/data": "/mnt/sda1/var/lib/docker/vfs/dir/d6441492325f772922ebb313020e98df1b318c3b6217dd9f9c40fe54b28a81d4"
    },
    "VolumesRW": {
        "/data": true
    }
}
]chenchun:project $ 

@marcuslinke
Copy link
Copy Markdown
Contributor

@chenchun Null bindings simply indicates that there was no binding at all. As it is impossible to modify bindings of an already created container there should be no need for this patch. Or am I missing something here?

@chenchun
Copy link
Copy Markdown
Contributor Author

@marcuslinke you are right, it means no binding. I think even if the value is null, it doesn't mean the key is useless. I create this PR cause I need these keys of "Ports" even if the values is null. Besides I think docker-java client should respect the format which docker daemon describes the container, make sense ?

marcuslinke added a commit that referenced this pull request Apr 28, 2015
@marcuslinke marcuslinke merged commit 3dc651e into docker-java:master Apr 28, 2015
@chenchun
Copy link
Copy Markdown
Contributor Author

Thanks very much.

@chenchun chenchun deleted the binding branch July 24, 2015 07:09
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.

2 participants