无法访问局域网上的docker容器

无法访问局域网上的docker容器

我的 docker 在 VmWare ESXi 服务器(Ubuntu 16 x64 服务器)上运行。我使用以下命令安装并启动了 rancher 容器:

docker run -d --restart=unless-stopped -p 9000:9000 -P --name rancher rancher/server

我尝试使用我的导航仪进行连接(http://10.192.212.223:9000),但它不起作用。我也尝试在服务器上使用 wget (wget 127.0.0.1:9000wget 172.17.0.1:9000)

 docker ps
 CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                      NAMES
 5dc3273e418c        rancher/server      "/usr/bin/entry /u..."   13 minutes ago      Up 13 minutes       0.0.0.0:9000->9000/tcp, 0.0.0.0:32771->3306/tcp, 0.0.0.0:32770->8080/tcp   rancher

以下是网络设置(docker inspect rancher):

    "NetworkSettings": {
        "Bridge": "",
        "SandboxID": "46d1f8a6a3cf10aea16befb8a3cda8ce15fe51e72996b29d0960fb33f274336d",
        "HairpinMode": false,
        "LinkLocalIPv6Address": "",
        "LinkLocalIPv6PrefixLen": 0,
        "Ports": {
            "3306/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "32771"
                }
            ],
            "8080/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "32770"
                }
            ],
            "9000/tcp": [
                {
                    "HostIp": "0.0.0.0",
                    "HostPort": "9000"
                }
            ]
        },

我有一个在端口 8081 上运行的 django 应用程序。没问题...这是我打开的端口:

$> lsof -i
COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
postgres   1162 postgres    6u  IPv4  16586      0t0  TCP *:postgresql (LISTEN)
postgres   1162 postgres    7u  IPv6  16587      0t0  TCP *:postgresql (LISTEN)
postgres   1162 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1176 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1177 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1178 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1179 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1180 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
sshd       1247     root    3u  IPv4  15022      0t0  TCP *:ssh (LISTEN)
sshd       1247     root    4u  IPv6  15024      0t0  TCP *:ssh (LISTEN)
python3.5  1872   usrwww    4u  IPv4  19068      0t0  TCP 10.192.212.223:48346->10.192.212.223:postgresql (ESTABLISHED)
python3.5  1872   usrwww    5u  IPv4  19072      0t0  TCP *:tproxy (LISTEN)
postgres   1885 postgres   11u  IPv6  14855      0t0  UDP localhost:54457->localhost:54457
postgres   1885 postgres   12u  IPv4  19069      0t0  TCP 10.192.212.223:postgresql->10.192.212.223:48346 (ESTABLISHED)
sshd       4536     root    3u  IPv4 661043      0t0  TCP 10.192.212.223:ssh->10.192.212.113:53951 (ESTABLISHED)
sshd       4627   usrwww    3u  IPv4 661043      0t0  TCP 10.192.212.223:ssh->10.192.212.113:53951 (ESTABLISHED)
nginx     28795     root    6u  IPv4 508524      0t0  TCP *:http (LISTEN)
nginx     28795     root    7u  IPv6 508525      0t0  TCP *:http (LISTEN)
nginx     28795     root    8u  IPv4 508526      0t0  TCP *:8000 (LISTEN)
nginx     28795     root    9u  IPv6 508527      0t0  TCP *:8000 (LISTEN)
nginx     28796 www-data    6u  IPv4 508524      0t0  TCP *:http (LISTEN)
nginx     28796 www-data    7u  IPv6 508525      0t0  TCP *:http (LISTEN)
nginx     28796 www-data    8u  IPv4 508526      0t0  TCP *:8000 (LISTEN)
nginx     28796 www-data    9u  IPv6 508527      0t0  TCP *:8000 (LISTEN)
nginx     28797 www-data    6u  IPv4 508524      0t0  TCP *:http (LISTEN)
nginx     28797 www-data    7u  IPv6 508525      0t0  TCP *:http (LISTEN)
nginx     28797 www-data    8u  IPv4 508526      0t0  TCP *:8000 (LISTEN)
nginx     28797 www-data    9u  IPv6 508527      0t0  TCP *:8000 (LISTEN)
nginx     28798 www-data    6u  IPv4 508524      0t0  TCP *:http (LISTEN)
nginx     28798 www-data    7u  IPv6 508525      0t0  TCP *:http (LISTEN)
nginx     28798 www-data    8u  IPv4 508526      0t0  TCP *:8000 (LISTEN)
nginx     28798 www-data    9u  IPv6 508527      0t0  TCP *:8000 (LISTEN)
nginx     28799 www-data    6u  IPv4 508524      0t0  TCP *:http (LISTEN)
nginx     28799 www-data    7u  IPv6 508525      0t0  TCP *:http (LISTEN)
nginx     28799 www-data    8u  IPv4 508526      0t0  TCP *:8000 (LISTEN)
nginx     28799 www-data    9u  IPv6 508527      0t0  TCP *:8000 (LISTEN)
docker-pr 30797     root    4u  IPv6 525143      0t0  TCP *:9000 (LISTEN)
docker-pr 30836     root    4u  IPv6 522635      0t0  TCP *:32770 (LISTEN)
docker-pr 30848     root    4u  IPv6 525556      0t0  TCP *:32771 (LISTEN)
gogs      32225     gogs    3u  IPv6 537639      0t0  TCP *:x11 (LISTEN)

以下是 iptables:

$> iptables -L -v -n
Chain INPUT (policy ACCEPT 178 packets, 14487 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
55125   22M DOCKER-ISOLATION  all  --  *      *       0.0.0.0/0            0.0.0.0/0
30661   19M DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0
30373   19M ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
24464 2744K ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy ACCEPT 87 packets, 11452 bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain DOCKER (1 references)
 pkts bytes target     prot opt in     out     source               destination
  176  9112 ACCEPT     tcp  --  !docker0 docker0  0.0.0.0/0            172.17.0.2           tcp dpt:9000
    0     0 ACCEPT     tcp  --  !docker0 docker0  0.0.0.0/0            172.17.0.2           tcp dpt:8080
    0     0 ACCEPT     tcp  --  !docker0 docker0  0.0.0.0/0            172.17.0.2           tcp dpt:3306

Chain DOCKER-ISOLATION (1 references)
 pkts bytes target     prot opt in     out     source               destination
55125   22M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0

ESXi 网络信息:

虚拟机 IP:

  1. 10.192.212.223
  2. fe80::20c:29ff:feeb:1259
  3. fe80::609a:8aff:fea3:e9c6
  4. 172.17.0.1
  5. fe80::42:b3ff:fe5c:a598

继电器(直接路径 I/O)= 是

ESXi 网络接口屏幕截图

我对其他容器也遇到同样的问题。

相关内容