Docker на привязке портов Windows не работает - PullRequest
0 голосов
/ 12 июня 2019

Я заметил, что сеть на моих недавно созданных док-контейнерах перестала работать на моем ноутбуке с Windows 10, поэтому я пошел к основам и запустил образ веб-сервера Windows, microsoft / iis: nanoserver.

Я запустил егос помощью команды: docker run -d -p 8080:80 --name web microsoft/iis:nanoserver

Но просмотр http://localhost:8080 ничего не находит.netstat -a не находит прослушивания на порту 8080.

Это произошло после того, как я играл в docker-compose, где я дал нескольким контейнерам свою собственную сеть.Наверное, после этого я оставил его в странном состоянии?

Когда я переключаюсь на контейнеры Linux, все работает нормально.

docker inspect web возвращает:

[
    {
        "Id": "67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22",
        "Created": "2019-06-12T11:33:08.7197232Z",
        "Path": "C:\\ServiceMonitor.exe",
        "Args": [
            "w3svc"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 1604,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2019-06-12T11:33:36.5159265Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:d4d34a16ef9d92b7fba6c81d175ee221b3326420928338523f1f52e2f8925042",
        "ResolvConfPath": "",
        "HostnamePath": "",
        "HostsPath": "",
        "LogPath": "C:\\ProgramData\\Docker\\containers\\67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22\\67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22-json.log",
        "Name": "/web",
        "RestartCount": 0,
        "Driver": "windowsfilter",
        "Platform": "windows",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "80/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "8080"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 0,
            "ConsoleSize": [
                81,
                226
            ],
            "Isolation": "hyperv",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": null,
            "ReadonlyPaths": null
        },
        "GraphDriver": {
            "Data": {
                "dir": "C:\\ProgramData\\Docker\\windowsfilter\\67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22"
            },
            "Name": "windowsfilter"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "67d95234c37c",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "microsoft/iis:nanoserver",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "C:\\ServiceMonitor.exe",
                "w3svc"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "8080"
                    }
                ]
            },
            "SandboxKey": "67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "nat": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "87bd53961ec7b882aa19f6bd45d1a4c6200845d83b1547e8e24e9f8ac62eef7a",
                    "EndpointID": "59b66765ffaecf14024b032236fcfbb4f7c6a4eb3eac6c074f83165706d3fc08",
                    "Gateway": "172.30.80.1",
                    "IPAddress": "172.30.81.248",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "00:15:5d:86:12:5c",
                    "DriverOpts": null
                }
            }
        }
    }
]

docker network inspect nat возвращает:

[
    {
        "Name": "nat",
        "Id": "87bd53961ec7b882aa19f6bd45d1a4c6200845d83b1547e8e24e9f8ac62eef7a",
        "Created": "2019-06-06T15:53:56.9856162+02:00",
        "Scope": "local",
        "Driver": "nat",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "windows",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.30.80.0/20",
                    "Gateway": "172.30.80.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "67d95234c37c9a851cb5f7c5fc8131c155030ec729e982ad8716c2fd83d0ff22": {
                "Name": "web",
                "EndpointID": "59b66765ffaecf14024b032236fcfbb4f7c6a4eb3eac6c074f83165706d3fc08",
                "MacAddress": "00:15:5d:86:12:5c",
                "IPv4Address": "172.30.81.248/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.windowsshim.hnsid": "03ba435e-d884-4daf-b8a5-3b066b4cc410",
            "com.docker.network.windowsshim.networkname": "nat"
        },
        "Labels": {}
    }
]
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...