microsoft / vscode-docker-extensibility

Docker for Visual Studio Code: Extensibility Model
MIT License
10 stars 4 forks source link

Cannot inspect the default "host" and "none" networks #228

Closed y0n1 closed 5 months ago

y0n1 commented 5 months ago

Does this occur consistently? Yes Repro steps:

  1. Expand the Networks section
  2. Right click on "host" or "none" network
  3. Choose "Inspect" from the context menu

Action: vscode-docker.networks.inspect Error type: TypeError Error Message: Cannot read properties of null (reading 'map')

Version: 1.29.0 OS: linux OS Release: 6.7.9-200.fc39.x86_64 Product: Visual Studio Code Product Version: 1.87.2 Language: en

Call Stack ``` normalizeDockerInspectNetworkRecord extension.bundle.js:2:2905160 extension.bundle.js:2:2895892 AutoConfigurableDockerClient.parseInspectNetworksCommandOutput extension.bundle.js:2:2895692 Object.parse extension.bundle.js:2:2896098 extension.bundle.js:2:2924098 ```
y0n1 commented 5 months ago

Additional info:

$ docker network list
NETWORK ID     NAME      DRIVER    SCOPE
b610d4c3d3fc   bridge    bridge    local
608f585347c3   host      host      local
9c34410cf805   none      null      local
$ docker network inspect bridge
[
    {
        "Name": "bridge",
        "Id": "b610d4c3d3fc4eb6f88c80c6231f240340f9cadb01d4d45ededa4941b1ceba85",
        "Created": "2024-03-30T14:17:20.801876601+03:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]
$  docker network inspect host  
[
    {
        "Name": "host",
        "Id": "608f585347c3a671d9dd46ed01eb9ddbdf81c09dfe70c66041c56e8d720293f3",
        "Created": "2024-03-29T12:44:49.905545585+03:00",
        "Scope": "local",
        "Driver": "host",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": null
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]
$ docker network inspect none
[
    {
        "Name": "none",
        "Id": "9c34410cf80577b525c297da59eb86090dfe12d0d9fe52f1dfef0a3cbd7064c7",
        "Created": "2024-03-29T12:44:49.882091566+03:00",
        "Scope": "local",
        "Driver": "null",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": null
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {},
        "Labels": {}
    }
]
y0n1 commented 5 months ago

It's because of the IPAM.Config is null in both networks. The code that normalizes the command output doesn't assume the Config object could be null

bwateratmsft commented 5 months ago

Since the bug is in the containers client package I'll move this issue to that repo.