Skip to content
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

Expose old config field for api < 1.19 #13675

Merged
merged 1 commit into from
Jun 2, 2015

Conversation

runcom
Copy link
Member

@runcom runcom commented Jun 2, 2015

/cc @icecrime @calavera @aanand

I tried everything (99.9999% sure) before going with a second function just for < 1.19 code path 👼
fixes #13663

Signed-off-by: Antonio Murdaca me@runcom.ninja

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
@calavera
Copy link
Contributor

calavera commented Jun 2, 2015

LGTM

@vieux
Copy link
Contributor

vieux commented Jun 2, 2015

One comment, it's not really an issue for me, but I know some people will complain.

When talking to the daemon using the API 1.18, you the the resources both in Config AND HostConfig

Using docker-1.6.1 against this branch, I did a docker run -d --name test -m 20m busybox ping google.com

This is the inspect:

{
    "Id": "65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242",
    "Created": "2015-06-02T22:02:01.844734237Z",
    "Path": "ping",
    "Args": [
        "google.com"
    ],
    "State": {
        "Running": true,
        "Paused": false,
        "Restarting": false,
        "OOMKilled": false,
        "Dead": false,
        "Pid": 27140,
        "ExitCode": 0,
        "Error": "",
        "StartedAt": "2015-06-02T22:02:01.981596487Z",
        "FinishedAt": "0001-01-01T00:00:00Z"
    },
    "Image": "8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55",
    "NetworkSettings": {
        "Bridge": "",
        "EndpointID": "2e0c684e6ce05f1db40215852634eee669d06db054d6babbf5759f552dcdc092",
        "Gateway": "172.17.42.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "HairpinMode": false,
        "IPAddress": "172.17.0.1",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "MacAddress": "02:42:5f:fa:8a:df",
        "NetworkID": "151b1ecce18213df39aba6e511fb766f62ebd36fb166a8653f2fcf2c299e6bde",
        "PortMapping": null,
        "Ports": {},
        "SandboxKey": "/var/run/docker/netns/65080757ba6b",
        "SecondaryIPAddresses": null,
        "SecondaryIPv6Addresses": null
    },
    "ResolvConfPath": "/var/lib/docker/containers/65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242/resolv.conf",
    "HostnamePath": "/var/lib/docker/containers/65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242/hostname",
    "HostsPath": "/var/lib/docker/containers/65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242/hosts",
    "LogPath": "/var/lib/docker/containers/65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242/65080757ba6b435a3a295e7175afa4824e227729289d0069458bc837dee0a242-json.log",
    "Name": "/test",
    "RestartCount": 0,
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "MountLabel": "",
    "ProcessLabel": "",
    "Volumes": {},
    "VolumesRW": {},
    "AppArmorProfile": "",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": [],
        "Memory": 20971520,
        "MemorySwap": -1,
        "CpuShares": 0,
        "CpuPeriod": 0,
        "CpusetCpus": "",
        "CpusetMems": "",
        "CpuQuota": 0,
        "BlkioWeight": 0,
        "OomKillDisable": false,
        "Privileged": false,
        "PortBindings": {},
        "Links": null,
        "PublishAllPorts": false,
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "VolumesFrom": null,
        "Devices": [],
        "NetworkMode": "bridge",
        "IpcMode": "",
        "PidMode": "",
        "UTSMode": "",
        "CapAdd": null,
        "CapDrop": null,
        "RestartPolicy": {
            "Name": "no",
            "MaximumRetryCount": 0
        },
        "SecurityOpt": null,
        "ReadonlyRootfs": false,
        "Ulimits": null,
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "CgroupParent": ""
    },
    "Config": {
        "Hostname": "65080757ba6b",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "ExposedPorts": null,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": [
            "ping",
            "google.com"
        ],
        "Image": "busybox",
        "Volumes": null,
        "VolumeDriver": "",
        "WorkingDir": "",
        "Entrypoint": null,
        "NetworkDisabled": false,
        "MacAddress": "",
        "OnBuild": null,
        "Labels": {},
        "Memory": 20971520,
        "MemorySwap": -1,
        "CpuShares": 0,
        "Cpuset": ""
    }
}

As you can see 20971520 is displayed twice.

@runcom
Copy link
Member Author

runcom commented Jun 2, 2015

@vieux I'm aware of this (while testing I came with your extact situation) but I think new fields are always exposed to older api so I didn't care. Is this really a problem? (I can find a way to fix this by masking HostConfig to a api/types struct but as per what I just said I don't think we should care)

@vieux
Copy link
Contributor

vieux commented Jun 2, 2015

@runcom it's fine by me, I juste wanted to make sure you were aware.

LGTM

@calavera
Copy link
Contributor

calavera commented Jun 2, 2015

@vieux that happens with docker 1.6.1 too because those fields where duplicated:

[{
    "AppArmorProfile": "",
    "Args": [
        "google.com"
    ],
    "Config": {
        "AttachStderr": false,
        "AttachStdin": false,
        "AttachStdout": false,
        "Cmd": [
            "ping",
            "google.com"
        ],
        "CpuShares": 0,
        "Cpuset": "",
        "Domainname": "",
        "Entrypoint": null,
        "Env": null,
        "ExposedPorts": null,
        "Hostname": "bfad39cd32f5",
        "Image": "busybox",
        "Labels": {},
        "MacAddress": "",
        "Memory": 20971520,
        "MemorySwap": -1,
        "NetworkDisabled": false,
        "OnBuild": null,
        "OpenStdin": false,
        "PortSpecs": null,
        "StdinOnce": false,
        "Tty": false,
        "User": "",
        "Volumes": null,
        "WorkingDir": ""
    },
    "Created": "2015-06-02T22:20:48.616028128Z",
    "Driver": "aufs",
    "ExecDriver": "native-0.2",
    "ExecIDs": null,
    "HostConfig": {
        "Binds": null,
        "CapAdd": null,
        "CapDrop": null,
        "CgroupParent": "",
        "ContainerIDFile": "",
        "CpuShares": 0,
        "CpusetCpus": "",
        "Devices": [],
        "Dns": null,
        "DnsSearch": null,
        "ExtraHosts": null,
        "IpcMode": "",
        "Links": null,
        "LogConfig": {
            "Config": null,
            "Type": "json-file"
        },
        "LxcConf": [],
        "Memory": 20971520,
        "MemorySwap": -1,
        "NetworkMode": "bridge",
        "PidMode": "",
        "PortBindings": {},
        "Privileged": false,
        "PublishAllPorts": false,
        "ReadonlyRootfs": false,
        "RestartPolicy": {
            "MaximumRetryCount": 0,
            "Name": "no"
        },
        "SecurityOpt": null,
        "Ulimits": null,
        "VolumesFrom": null
    },
    "HostnamePath": "/var/lib/docker/containers/bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859/hostname",
    "HostsPath": "/var/lib/docker/containers/bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859/hosts",
    "Id": "bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859",
    "Image": "8c2e06607696bd4afb3d03b687e361cc43cf8ec1a4a725bc96e39f05ba97dd55",
    "LogPath": "/var/lib/docker/containers/bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859/bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859-json.log",
    "MountLabel": "",
    "Name": "/test1",
    "NetworkSettings": {
        "Bridge": "docker0",
        "Gateway": "172.17.42.1",
        "GlobalIPv6Address": "",
        "GlobalIPv6PrefixLen": 0,
        "IPAddress": "172.17.0.6",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",
        "LinkLocalIPv6Address": "fe80::42:acff:fe11:6",
        "LinkLocalIPv6PrefixLen": 64,
        "MacAddress": "02:42:ac:11:00:06",
        "PortMapping": null,
        "Ports": {}
    },
    "Path": "ping",
    "ProcessLabel": "",
    "ResolvConfPath": "/var/lib/docker/containers/bfad39cd32f577bf7853028cb0dfaeb2c4230e4aba14cf346541e04d0507d859/resolv.conf",
    "RestartCount": 0,
    "State": {
        "Dead": false,
        "Error": "",
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "OOMKilled": false,
        "Paused": false,
        "Pid": 10572,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2015-06-02T22:20:48.719311857Z"
    },
    "Volumes": {},
    "VolumesRW": {}
}
]

@vieux
Copy link
Contributor

vieux commented Jun 2, 2015

@calavera ok thanks!

calavera added a commit that referenced this pull request Jun 2, 2015
Expose old config field for api < 1.19
@calavera calavera merged commit af09b06 into moby:master Jun 2, 2015
@runcom runcom deleted the 13663-config-regression branch June 2, 2015 22:24
@aanand
Copy link
Contributor

aanand commented Jun 3, 2015

🍰

@jessfraz
Copy link
Contributor

cherry-picked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resource options are missing from Config JSON
7 participants