Skip to content
This repository was archived by the owner on Feb 1, 2021. It is now read-only.
This repository was archived by the owner on Feb 1, 2021. It is now read-only.

Skip redundant endpoints in "network inspect" #1969

@mavenugo

Description

@mavenugo

With moby/moby#21160, docker engine will return all the endpoints (local, remote & stale endpoints). The remote and stale endpoints will have be represented as ep-{endpoint-id} . Example output from a host that doesn't own this endpoint (which represents the remote container).

$ sudo docker network inspect test2
[
    {
        "Name": "test2",
        "Id": "eaa6a4786dcba692bf240f4199848d565b2948c0481d1987051d5ce4eef080b6",
        "Scope": "global",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "10.0.1.0/24",
                    "Gateway": "10.0.1.1/24"
                }
            ]
        },
        "Internal": false,
        "Containers": {
            "ep-84dcacdbed8ed7fcd2004d43612bb5bba91aceaf12c77ba6943e2c075e9d22dd": {
                "Name": "ep3",
                "EndpointID": "84dcacdbed8ed7fcd2004d43612bb5bba91aceaf12c77ba6943e2c075e9d22dd",
                "MacAddress": "02:42:0a:00:01:02",
                "IPv4Address": "10.0.1.2/24",
                "IPv6Address": ""
            }
        },
        "Options": {}
    }
]

This would cause duplicate endpoints in the docker network inspect output when executed in a swarm environment.

The fix is to skip such duplicate endpoints. But make sure the stale endpoints (which will not have a duplicate endpoint-id) should be returned.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions