无法创建使用静态IP覆盖网络上的搬运工容器

问题描述 投票:4回答:1

上一页使用多克尔17.05,我能够创建子网10.0.7.0/24覆盖网络,然后我就能够创建一个IP 10.0.7.2的容器。

现在,我使用泊坞18.03,我能够与子网10.0.7.0/24创建覆盖网络。但我不能够创建与IP 10.0.7.2的容器。我知道,10.0.7.1是网关IP。但是,什么是10.0.7.2被用于新的码头工人(18.03)。

请,有谁能够解释为什么出现这种情况?

在泊坞18.03,mynet是我的覆盖网络

> docker inspect mynet
[
    {
        "Name": "mynet",
        "Id": "4lq0j7thvyb8dkwt0zbbvgski",
        "Created": "2018-03-29T09:27:41.369349452Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.7.0/24",
                    "Gateway": "10.0.7.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4102"
        },
        "Labels": null
    }
]

docker run是示出此错误:

> docker run -dit --name mycon --network mynet --ip 10.0.7.2 ubuntu:16.04
caebeda51357d8e53f11fb765c8b4a65bd6c37d6746dbbdd1b4b8be7e6235a44
docker: Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded.

提前致谢。

docker docker-swarm
1个回答
1
投票

检查群节点设置为availability=drain

此问题已记录here

否则,在18.03,我还没有遇到这个问题。

如果availability设置为主动,我打你的问题,如果它被设置为drain以下网络为我工作。

docker inspect ovr2 [
    {
        "Name": "ovr2",
        "Id": "28a5i9gcnys642u059ltfcjut",
        "Created": "2018-11-20T16:26:07.458744293Z",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.7.0/24",
                    "Gateway": "10.0.7.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": true,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": null,
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "4097"
        },
        "Labels": null
    } ]
© www.soinside.com 2019 - 2024. All rights reserved.