Guangya Liu created MESOS-4904:
----------------------------------
Summary: Handle the case of default network with docker
containerizer
Key: MESOS-4904
URL: https://issues.apache.org/jira/browse/MESOS-4904
Project: Mesos
Issue Type: Bug
Reporter: Guangya Liu
Priority: Minor
This ticket is from some discussion of
https://reviews.apache.org/r/44531/#review122860
{code}
root@mesos002:~# docker run -it ubuntu:14.04 /bin/bash
root@ef2f9e7f17a1:/#
root@mesos002:/home/gyliu# docker inspect ef2f9e7f17a1
[
{
"Id":
"ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a",
"Created": "2016-03-10T02:08:18.885865957Z",
"Path": "/bin/bash",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 2073,
"ExitCode": 0,
"Error": "",
"StartedAt": "2016-03-10T02:08:19.051790509Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image":
"sha256:07c86167cdc4264926fa5d2894e34a339ad27f730e8cc81a16cd21b7479e8eac",
"ResolvConfPath":
"/var/lib/docker/containers/ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a/resolv.conf",
"HostnamePath":
"/var/lib/docker/containers/ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a/hostname",
"HostsPath":
"/var/lib/docker/containers/ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a/hosts",
"LogPath":
"/var/lib/docker/containers/ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a/ef2f9e7f17a18ac5b8a3366a41dd4b098676ab57bb2f04beada6961eae875f8a-json.log",
"Name": "/amazing_bell",
"RestartCount": 0,
"Driver": "overlay",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default", <<<<<<<<
"PortBindings": {},
"RestartPolicy": {
"Name": "no",
"MaximumRetryCount": 0
},
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"ShmSize": 67108864,
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"KernelMemory": 0,
"Memory": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": -1,
"OomKillDisable": false,
"PidsLimit": 0,
"Ulimits": null
},
"GraphDriver": {
"Name": "overlay",
"Data": {
"LowerDir":
"/var/lib/docker/overlay/6f9d53edacc592ed40551d7a8d0f8220faee8cba45ceefb378af05c1c40393ae/root",
"MergedDir":
"/var/lib/docker/overlay/5757e2aef1a37a794743423eeea055199b16f5447b854f89a1bfee02f45322bd/merged",
"UpperDir":
"/var/lib/docker/overlay/5757e2aef1a37a794743423eeea055199b16f5447b854f89a1bfee02f45322bd/upper",
"WorkDir":
"/var/lib/docker/overlay/5757e2aef1a37a794743423eeea055199b16f5447b854f89a1bfee02f45322bd/work"
}
},
"Mounts": [],
"Config": {
"Hostname": "ef2f9e7f17a1",
"Domainname": "",
"User": "",
"AttachStdin": true,
"AttachStdout": true,
"AttachStderr": true,
"Tty": true,
"OpenStdin": true,
"StdinOnce": true,
"Env": [],
"Cmd": [
"/bin/bash"
],
"Image": "ubuntu:14.04",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {},
"StopSignal": "SIGTERM"
},
"NetworkSettings": {
"Bridge": "", <<<<<<<<
"SandboxID":
"1961336c5ecb2f1676c064a019c792e2f15033773702f6d6c90e17912049c1cc",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/1961336c5ecb",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID":
"ea4d85a1a79850c0c2259c0d211c023bc2601edd192c4deb9b48b302e36cee37",
"Gateway": "172.17.0.1",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"MacAddress": "02:42:ac:11:00:02",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID":
"3567b0561e6047aa9bd4a614420373d8f7a6ba1d97978820186a78c0c07180ac",
"EndpointID":
"ea4d85a1a79850c0c2259c0d211c023bc2601edd192c4deb9b48b302e36cee37",
"Gateway": "172.17.0.1",
"IPAddress": "172.17.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:11:00:02"
}
}
}
}
]
{code}
When create a docker container without --net option, the NetworkMode is default
when using bridge mode, then the docker containerizer will construct a string
{{"NetworkSettings.Networks." + NetworkMode + ".IPAddress}} as the
addressLocation for the container, but this is not true as the actual address
location is {{NetworkSettings.Networks.bridge.IPAddress}}.
The mesos do not support {{default}} network for now, but once we introduced
the user defined network, this will be a problem cause we cannot get the exact
IP address for the container when using docker containizer.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)