简体   繁体   English

Windows 10上的docker:容器没有IP地址

[英]docker on windows 10: container has no ip address

First step: I loaded the Images from a local drive: 第一步:我从本地驱动器加载了图像:

docker load -i postgres10.tar
docker load -i drupaldrush1.tar

Second step: I started the containers: 第二步:我启动了容器:

 docker run -p5432:5432 postgres:10
 docker run -p8081:8081 drupaldrush:1

Third step: displaying containers: 第三步:显示容器:

docker ps

results in: 结果是:

CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                            NAMES
b77bcc79d599        drupaldrush:1       "docker-php-entrypoi…"   33 seconds ago       Up 32 seconds       80/tcp, 0.0.0.0:8081->8081/tcp   flamboyant_easley
97b9ba5f2779        postgres:10         "docker-entrypoint.s…"   About a minute ago   Up About a minute   0.0.0.0:5432->5432/tcp           competent_fermat

BUT container is not available under: localhost:8081 但是以下容器不可用:localhost:8081

Fourth step: inspecting container: 第四步:检查集装箱:

 docker inspect flamboyant_easley

resulting in (among other Information): 导致(除其他信息外):

"HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LogConfig": {
            "Type": "json-file",
            "Config": {}
        },
        "NetworkMode": "default",
        "PortBindings": {
            "8081/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "8081"
                }
            ]
        },

and

  "IPAddress": "172.17.0.3",
        "IPPrefixLen": 16,
        "IPv6Gateway": "",

        "Networks": {
            "bridge": {
                "IPAMConfig": null,
                "Links": null,
                "Aliases": null,
                "NetworkID": "d5e552bf9c57050fe2debfc7d38a784580309fa0b72c4854a563e78295128912",
                "EndpointID": "f61b02c5997b2e391add348686f658b4c596dd60495365cee0fee539743d4792",
                "Gateway": "172.17.0.1",
                "IPAddress": "172.17.0.3",
                "IPPrefixLen": 16,
                "IPv6Gateway": "",
                "GlobalIPv6Address": "",
                "GlobalIPv6PrefixLen": 0,    

Problem: The container is not available under localhost:8081 and not under 172.17.0.3: 8081 or 172.17.0.1:8081 Question: What do I have to do to make it run under localhost:8081? 问题:容器在localhost:8081下不可用,而在172.17.0.3:8081或172.17.0.1:8081下不可用。问题:如何使它在localhost:8081下运行?

The problems came from Docker for Windows. 问题来自Windows的Docker。 Now I got a Linux Laptop and everything works just fine. 现在我有了一台Linux笔记本电脑,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM