泊坞窗版本 - V1.12 操作系统 - Ubuntu的14.04.4-LTS 聚类模式 - 群多克容器的网络模式更改为默认运行容器时
创建了一个覆盖网络: $ docker -H tcp://0.0.0.0:2375 network create --driver overlay --subnet=10.0.9.0/24 my-net
创建容器: [POST] http://localhost:2375/container/create?name={id}
响应$docker inspect
{
"Env": [
"env1=val1"
],
"Cmd": [
"/Run.sh",
"launch
],
"Image": "<image>",
"Volumes": {
"/tmp" : {}
},
"HostConfig": {
"NetworkMode": "my-net"
}
}
:
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "my-net",
"PortBindings": null,
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
}
这创建容器与networkMode为my-net
。但是当我运行 容器使用其余的API [POST] http://localhost:2375/containers/{id}/start
networkMode更改为 default
。
的$docker inspect
响应:
"HostConfig": {
"Binds": null,
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": null,
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
}
问题不在于cli命令。这是当我使用其余的API。 –