首页 > 解决方案 > Docker:无法删除 macvlan 配置网络

问题描述

使用 portainer,我创建了一个 macvlan 配置网络。现在,我想删除这个网络。但是,由于某种原因,我不能。我确实收到以下错误消息:Error response from daemon: error while removing network: configuration network "my_macvlan_config" is in use。奇怪的是,我不认为网络正在使用中。它没有连接容器。检查网络时,我得到以下结果:

~$ sudo docker network inspect my_macvlan_config
[
    {
        "Name": "my_macvlan_config",
        "Id": "5d95270684516484632c4505e15ba8253bbe8d780b2c41a84a07fbbe09d7a9b6",
        "Created": "2020-05-18T20:59:03.472260896+02:00",
        "Scope": "local",
        "Driver": "null",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.13.0/24",
                    "IPRange": "192.168.13.200/29",
                    "Gateway": "192.168.13.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": true,
        "Containers": {},
        "Options": {
            "parent": "eth0"
        },
        "Labels": {}
    }
]

Docker 本身正在我的 Synology Diskstation 上运行,fwiw。

编辑:有另一个网络称为macvlan连接到my_macvlan_config.

~$ sudo docker network inspect macvlan
[
    {
        "Name": "macvlan",
        "Id": "8a831afa776475b01ca240f4b6b2434c820b8a03910b402760e3cd988e7ddb5c",
        "Created": "2020-05-23T23:11:17.738229138+02:00",
        "Scope": "local",
        "Driver": "macvlan",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.13.0/24",
                    "IPRange": "192.168.13.210/29",
                    "Gateway": "192.168.13.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": "macvlan_config"
        },
        "ConfigOnly": false,
        "Containers": {
            "6f025749fe99a22fa3729bebfa72d6329b363fe8f6589d9147d0d58a9934dd42": {
                "Name": "tvheadend",
                "EndpointID": "bc827cb2fddc4374fde7634534efd0c8c110af5a70aa9b16a319b770dfe7a0f2",
                "MacAddress": "02:42:c0:a8:0d:d3",
                "IPv4Address": "192.168.13.211/24",
                "IPv6Address": ""
            }
        },
        "Options": {
            "parent": "eth0"
        },
        "Labels": {}
    }
]

还有一个网络,显然是无关的。

~$ sudo docker network inspect macvlan_config
[
    {
        "Name": "macvlan_config",
        "Id": "644a15c6b9e653ec3f48c4a2e290f996b41361170d5ab63053b87a301168345f",
        "Created": "2020-05-23T23:10:54.880348491+02:00",
        "Scope": "local",
        "Driver": "null",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "192.168.13.0/24",
                    "IPRange": "192.168.13.210/29",
                    "Gateway": "192.168.13.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": true,
        "Containers": {},
        "Options": {
            "parent": "eth0"
        },
        "Labels": {}
    }
]

然后我移除了tvheadend容器。然后我能够删除所有网络,但my_macvlan_config.

标签: dockermacvlan

解决方案


推荐阅读