Skip to content

docker network inspect <NETWORK-ID> only returns containers local to current node  #24186

@sfsmithcha

Description

@sfsmithcha

Output of docker version:

$ docker version
Client:
 Version:      1.12.0-rc2
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   906eacd
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.0-rc2
 API version:  1.24
 Go version:   go1.6.2
 Git commit:   906eacd
 Built:        
 OS/Arch:      linux/amd64

Output of docker info:

$ docker info
Containers: 7
 Running: 2
 Paused: 0
 Stopped: 5
Images: 7
Server Version: 1.12.0-rc2
Storage Driver: overlay
 Backing Filesystem: xfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host null bridge overlay
Swarm: active
 NodeID: 1120tlfjfl8hb8ej0vl4jf0uk
 IsManager: Yes
 Managers: 1
 Nodes: 3
 CACertHash: sha256:e40f879fdf091f783caae7790db4defc1e1828bc31101029ac18cfb2fdbb56b5
Runtimes: default
Default Runtime: default
Security Options: seccomp
Kernel Version: 3.10.0-327.10.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 991.7 MiB
Name: manager1
ID: VVLS:3SXS:G7IZ:I6MG:DOQ6:VDI5:YWPO:E3XF:ZPMH:RP7C:RBAN:W2SG
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-ip6tables is disabled
Insecure Registries:
 127.0.0.0/8

This is more of an enhancement, but I think in the context of a swarm/cluster, I may want to list the containers participating in the entire network, not just on the current node. And see which nodes the containers are running on.

$ docker network inspect mynetwork
[
    {
        "Name": "mynetwork",
        "Id": "8ftib96dxooksdj8b4chprun2",
        "Scope": "swarm",
        "Driver": "overlay",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "75.1.0.0/16",
                    "Gateway": "75.1.0.1"
                }
            ]
        },
        "Internal": false,
        "Containers": {
            "8ec6bc3e3cbb2d22d2c66859b9051c99ab7bd753172a57b89b679b7c80787365": {
                "Name": "frontend.1.5natc1sik5v7i8174h3jzazdo",
                "EndpointID": "cef522ff38f26e9a7284bc273a1f083e560baf297f11050c282ec42688047f34",
                "MacAddress": "02:42:4b:01:00:06",
                "IPv4Address": "75.1.0.6/16",
                "IPv6Address": ""
            },
            "b3455bee301a3f700276ff54bba87c2c3418dbfff6c5c117c46c12c23a027d16": {
                "Name": "redis.1.dsej2jdxc9g2qlvm39m19vn60",
                "EndpointID": "93d447d8d90207aca66e7766e2e5537a2525bb8f529a508c67fb27bfd92dbb7a",
                "MacAddress": "02:42:4b:01:00:08",
                "IPv4Address": "75.1.0.8/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.driver.overlay.vxlanid_list": "257"
        },
        "Labels": {}
    }
]

Describe the results you expected:
See all containers on the network and the node where they're running regardless of the current node.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions