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.

docker network inspect output is flaky/wrong #1525

@ahmetb

Description

@ahmetb

When I run the following on my Swarm cluster:

docker network create frontend
docker run -d --net frontend --name fe1 nginx
docker run -d --net frontend --name fe2 nginx
docker run -d --net frontend --name fe3 nginx
docker run -d --net frontend --name fe4 nginx

and execute docker network inspect frontend I pretty much always get different output every time (pay attention to Containers→IPv4Address):

$ docker network inspect frontend
[
    {
        "Name": "frontend",
        "Id": "acde7eaf4651c0da70c8077d47882ccac8d17d071ebd69f2fc212d15a697804f",
        "Scope": "global",
        "Driver": "overlay",
        "IPAM": {
            "Driver": "default",
            "Config": [
                {}
            ]
        },
        "Containers": {},
        "Options": {}
    }
]
[
    {
        "Name": "frontend",
        "Id": "acde7eaf4651c0da70c8077d47882ccac8d17d071ebd69f2fc212d15a697804f",
        "Scope": "global",
        "Driver": "overlay",
        "IPAM": {
            "Driver": "default",
            "Config": [
                {}
            ]
        },
        "Containers": {
            "f34345e2351b98150387bc4136324c73ab5d8df3162a1e4a8674b9d55d24c07d": {
                "EndpointID": "4e13bbd62e91eb7a3803b82460a5c207c07e2c300a15bdf3736f17a43f8691da",
                "MacAddress": "02:42:0a:00:00:05",
                "IPv4Address": "10.0.0.5/24",
                "IPv6Address": ""
            }
        },
        "Options": {}
    }
]
[
    {
        "Name": "frontend",
        "Id": "acde7eaf4651c0da70c8077d47882ccac8d17d071ebd69f2fc212d15a697804f",
        "Scope": "global",
        "Driver": "overlay",
        "IPAM": {
            "Driver": "default",
            "Config": [
                {}
            ]
        },
        "Containers": {
            "2c2e8c1eb9e3f673fce36cf0c28b542f2a10174adc51fa23c59dafb7546c7c41": {
                "EndpointID": "de9fc2b4df99c83a84cde04fca0253d8c37cf0c8a4b7bf55d7a82f3f2fd9e594",
                "MacAddress": "02:42:0a:00:00:04",
                "IPv4Address": "10.0.0.4/24",
                "IPv6Address": ""
            }
        },
        "Options": {}
    }
]
[
    {
        "Name": "frontend",
        "Id": "acde7eaf4651c0da70c8077d47882ccac8d17d071ebd69f2fc212d15a697804f",
        "Scope": "global",
        "Driver": "overlay",
        "IPAM": {
            "Driver": "default",
            "Config": [
                {}
            ]
        },
        "Containers": {
            "9d4bac5e5b7daf59b7a474fc9cf04078fe84e84d4a126f1ef40e70d4fb20b416": {
                "EndpointID": "693b23d5aa5bfbe5bfb9e37b45ed8622ca7802d7f5ed9578de41bb873315b989",
                "MacAddress": "02:42:0a:00:00:06",
                "IPv4Address": "10.0.0.6/24",
                "IPv6Address": ""
            }
        },
        "Options": {}
    }
]
[
    {
        "Name": "frontend",
        "Id": "acde7eaf4651c0da70c8077d47882ccac8d17d071ebd69f2fc212d15a697804f",
        "Scope": "global",
        "Driver": "overlay",
        "IPAM": {
            "Driver": "default",
            "Config": [
                {}
            ]
        },
        "Containers": {
            "f358b856f8d62138183174e5b0bdd066919ac7ca5bd5f118363dc3e9ef50884c": {
                "EndpointID": "66927023d38a311d6dda1d05b1d826e50ca3b5d45b93e79637c3cf0ca3c97041",
                "MacAddress": "02:42:0a:00:00:03",
                "IPv4Address": "10.0.0.3/24",
                "IPv6Address": ""
            }
        },
        "Options": {}
    }
]

as shown above it mostly returns a random container and sometimes it does not return any "Containers" at all.

It never returned more than one container in this response as far as I can tell (I ran the command probably 30 times).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions