Docker端口没有正确暴露

时间:2016-10-06 18:14:24

标签: docker tcp port couchbase

我有一个Docker容器(运行Couchbase)需要大量开放端口。所以我使用以下方式运行容器:

docker run -d -p 4369:4369 -p 11209-11212:11209-11212 -p 8091-8092:8091-8092 -p 18091-18092:18091-18092 -p 11214-11215:11214-11215 -p 21100-21299:21100-21299 my-couchbase:latest

出现以便正常运行。我可以导航到http://<docker_ip>:8091并查看管理控制台等。

但是,在使用Couchbase Node SDK时,我无法连接,而是会收到描述here的TCP错误,这表明端口未公开。为了检查开放端口,我运行nmap -v 192.168.99.100(我的码头工具IP),并且看不到任何打开的东西! 这怎么可能?

有没有人知道如何验证端口是否在Docker容器上正确打开?我在这里不知所措。

快速docker ps显示:

5ca8ab8624b  my-couchbase:latest  "run_couchbase.sh"  18 minutes ago   Up 18 minutes  0.0.0.0:4369->4369/tcp, 9100-9105/tcp, 9998-9999/tcp, 0.0.0.0:8091-8092->8091-8092/tcp, 0.0.0.0:11209-11212->11209-11212/tcp, 0.0.0.0:11214-11215->11214-11215/tcp, 0.0.0.0:18091-18092->18091-18092/tcp, 11207/tcp, 0.0.0.0:21100-21199->21100-21199/tcp, 21200-21299/tcp   pensive_aryabhata

更新

里面的运行容器中运行netstat -nat后,我得到:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:11209           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:11210           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:35914         0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:18091           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:11212           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:42412           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:18092           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:21100           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:11213         0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:21101           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:11214           0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:11215         0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:45936           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8091            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8092            0.0.0.0:*               LISTEN     
tcp        0      0 172.17.0.2:8091         192.168.99.1:54781      ESTABLISHED
tcp        0      0 127.0.0.1:35369         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:41219         ESTABLISHED
tcp        0      0 127.0.0.1:35333         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:39544         127.0.0.1:8091          ESTABLISHED
tcp        0      0 127.0.0.1:8091          127.0.0.1:39542         ESTABLISHED
tcp        0      0 127.0.0.1:21100         127.0.0.1:40371         ESTABLISHED
tcp        0      0 127.0.0.1:54793         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:4369          127.0.0.1:56063         ESTABLISHED
tcp        0      0 127.0.0.1:11213         127.0.0.1:55322         ESTABLISHED
tcp        0      0 127.0.0.1:55326         127.0.0.1:11213         ESTABLISHED
tcp        0      0 127.0.0.1:45342         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:54793         ESTABLISHED
tcp        0      0 127.0.0.1:8091          127.0.0.1:39544         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:58125         ESTABLISHED
tcp        0      0 127.0.0.1:38466         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:53351         ESTABLISHED
tcp        0      0 127.0.0.1:40371         127.0.0.1:21100         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:38466         ESTABLISHED
tcp        0      0 127.0.0.1:11213         127.0.0.1:55326         ESTABLISHED
tcp        0      0 127.0.0.1:52594         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:35333         ESTABLISHED
tcp        0      0 127.0.0.1:41219         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:54662         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:35369         ESTABLISHED
tcp        0      0 127.0.0.1:54662         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:53351         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:45342         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:60332         ESTABLISHED
tcp        0      0 127.0.0.1:4369          127.0.0.1:45406         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:36552         ESTABLISHED
tcp        0      0 127.0.0.1:55322         127.0.0.1:11213         ESTABLISHED
tcp        0      0 127.0.0.1:36552         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:36924         ESTABLISHED
tcp        0      0 127.0.0.1:36924         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:56063         127.0.0.1:4369          ESTABLISHED
tcp        0      0 127.0.0.1:60332         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:52594         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:36954         ESTABLISHED
tcp        0      0 127.0.0.1:45406         127.0.0.1:4369          ESTABLISHED
tcp        0      0 172.17.0.2:8091         192.168.99.1:54762      ESTABLISHED
tcp        0      0 127.0.0.1:36954         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:53658         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:11209         127.0.0.1:53658         ESTABLISHED
tcp        0      0 127.0.0.1:58125         127.0.0.1:11209         ESTABLISHED
tcp        0      0 127.0.0.1:39542         127.0.0.1:8091          ESTABLISHED
tcp6       0      0 :::34781                :::*                    LISTEN     
tcp6       0      0 :::37055                :::*                    LISTEN     
tcp6       0      0 :::11211                :::*                    LISTEN     
tcp6       0      0 :::11212                :::*                    LISTEN

我不确定这有多大帮助......

更新2

根据@ jmreicha的建议,我在VirtualBox(Boot2docker,因为我在OSX上)中运行并运行相同的netstat -nat命令:

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      
tcp        0      0 10.0.2.15:22            10.0.2.2:56257          ESTABLISHED 
tcp        0      0 :::21104                :::*                    LISTEN      
tcp        0      0 :::21136                :::*                    LISTEN      
tcp        0      0 :::21168                :::*                    LISTEN      
tcp        0      0 :::21105                :::*                    LISTEN      
tcp        0      0 :::21137                :::*                    LISTEN      
tcp        0      0 :::21169                :::*                    LISTEN      
tcp        0      0 :::4369                 :::*                    LISTEN      
tcp        0      0 :::21106                :::*                    LISTEN      
tcp        0      0 :::21138                :::*                    LISTEN      
tcp        0      0 :::21170                :::*                    LISTEN      
tcp        0      0 :::21107                :::*                    LISTEN      
tcp        0      0 :::21139                :::*                    LISTEN      
tcp        0      0 :::21171                :::*                    LISTEN      
tcp        0      0 :::21108                :::*                    LISTEN      
tcp        0      0 :::21140                :::*                    LISTEN      
tcp        0      0 :::21172                :::*                    LISTEN      
tcp        0      0 :::21109                :::*                    LISTEN      
tcp        0      0 :::21141                :::*                    LISTEN      
tcp        0      0 :::21173                :::*                    LISTEN      
tcp        0      0 :::21110                :::*                    LISTEN      
tcp        0      0 :::21142                :::*                    LISTEN      
tcp        0      0 :::21174                :::*                    LISTEN      
tcp        0      0 :::22                   :::*                    LISTEN      
tcp        0      0 :::21111                :::*                    LISTEN      
tcp        0      0 :::21143                :::*                    LISTEN      
tcp        0      0 :::21175                :::*                    LISTEN      
tcp        0      0 :::21112                :::*                    LISTEN      
tcp        0      0 :::21144                :::*                    LISTEN      
tcp        0      0 :::21176                :::*                    LISTEN      
tcp        0      0 :::21113                :::*                    LISTEN      
tcp        0      0 :::21145                :::*                    LISTEN      
tcp        0      0 :::21177                :::*                    LISTEN      
tcp        0      0 :::21114                :::*                    LISTEN      
tcp        0      0 :::21146                :::*                    LISTEN      
tcp        0      0 :::21178                :::*                    LISTEN      
tcp        0      0 :::8091                 :::*                    LISTEN      
tcp        0      0 :::21115                :::*                    LISTEN      
tcp        0      0 :::21147                :::*                    LISTEN      
tcp        0      0 :::21179                :::*                    LISTEN      
tcp        0      0 :::21116                :::*                    LISTEN      
tcp        0      0 :::21148                :::*                    LISTEN      
tcp        0      0 :::21180                :::*                    LISTEN      
tcp        0      0 :::8092                 :::*                    LISTEN      
tcp        0      0 :::21117                :::*                    LISTEN      
tcp        0      0 :::21149                :::*                    LISTEN      
tcp        0      0 :::21181                :::*                    LISTEN      
tcp        0      0 :::21118                :::*                    LISTEN      
tcp        0      0 :::21150                :::*                    LISTEN      
tcp        0      0 :::21182                :::*                    LISTEN      
tcp        0      0 :::21119                :::*                    LISTEN      
tcp        0      0 :::21151                :::*                    LISTEN      
tcp        0      0 :::21183                :::*                    LISTEN      
tcp        0      0 :::21120                :::*                    LISTEN      
tcp        0      0 :::21152                :::*                    LISTEN      
tcp        0      0 :::21184                :::*                    LISTEN      
tcp        0      0 :::21121                :::*                    LISTEN      
tcp        0      0 :::21153                :::*                    LISTEN      
tcp        0      0 :::21185                :::*                    LISTEN      
tcp        0      0 :::21122                :::*                    LISTEN      
tcp        0      0 :::21154                :::*                    LISTEN      
tcp        0      0 :::21186                :::*                    LISTEN      
tcp        0      0 :::21123                :::*                    LISTEN      
tcp        0      0 :::21187                :::*                    LISTEN      
tcp        0      0 :::21155                :::*                    LISTEN      
tcp        0      0 :::21124                :::*                    LISTEN      
tcp        0      0 :::21156                :::*                    LISTEN      
tcp        0      0 :::21188                :::*                    LISTEN      
tcp        0      0 :::21125                :::*                    LISTEN      
tcp        0      0 :::21157                :::*                    LISTEN      
tcp        0      0 :::21189                :::*                    LISTEN      
tcp        0      0 :::21126                :::*                    LISTEN      
tcp        0      0 :::21158                :::*                    LISTEN      
tcp        0      0 :::21190                :::*                    LISTEN      
tcp        0      0 :::21127                :::*                    LISTEN      
tcp        0      0 :::21159                :::*                    LISTEN      
tcp        0      0 :::21191                :::*                    LISTEN      
tcp        0      0 :::21128                :::*                    LISTEN      
tcp        0      0 :::21192                :::*                    LISTEN      
tcp        0      0 :::21160                :::*                    LISTEN      
tcp        0      0 :::2376                 :::*                    LISTEN      
tcp        0      0 :::11209                :::*                    LISTEN      
tcp        0      0 :::21129                :::*                    LISTEN      
tcp        0      0 :::21161                :::*                    LISTEN      
tcp        0      0 :::21193                :::*                    LISTEN      
tcp        0      0 :::11210                :::*                    LISTEN      
tcp        0      0 :::21130                :::*                    LISTEN      
tcp        0      0 :::21162                :::*                    LISTEN      
tcp        0      0 :::21194                :::*                    LISTEN      
tcp        0      0 :::11211                :::*                    LISTEN      
tcp        0      0 :::18091                :::*                    LISTEN      
tcp        0      0 :::21131                :::*                    LISTEN      
tcp        0      0 :::21163                :::*                    LISTEN      
tcp        0      0 :::21195                :::*                    LISTEN      
tcp        0      0 :::6379                 :::*                    LISTEN      
tcp        0      0 :::11212                :::*                    LISTEN      
tcp        0      0 :::18092                :::*                    LISTEN      
tcp        0      0 :::21132                :::*                    LISTEN      
tcp        0      0 :::21100                :::*                    LISTEN      
tcp        0      0 :::21164                :::*                    LISTEN      
tcp        0      0 :::21196                :::*                    LISTEN      
tcp        0      0 :::21101                :::*                    LISTEN      
tcp        0      0 :::21133                :::*                    LISTEN      
tcp        0      0 :::21165                :::*                    LISTEN      
tcp        0      0 :::21197                :::*                    LISTEN      
tcp        0      0 :::21102                :::*                    LISTEN      
tcp        0      0 :::21134                :::*                    LISTEN      
tcp        0      0 :::21166                :::*                    LISTEN      
tcp        0      0 :::21198                :::*                    LISTEN      
tcp        0      0 :::11214                :::*                    LISTEN      
tcp        0      0 :::11215                :::*                    LISTEN      
tcp        0      0 :::21103                :::*                    LISTEN      
tcp        0      0 :::21135                :::*                    LISTEN      
tcp        0      0 :::21167                :::*                    LISTEN      
tcp        0      0 :::21199                :::*                    LISTEN      
tcp        0      0 ::ffff:192.168.99.100:2376 ::ffff:192.168.99.1:56244 ESTABLISHED 
tcp        0      0 ::ffff:192.168.99.100:2376 ::ffff:192.168.99.1:54634 ESTABLISHED 
tcp        0      0 ::ffff:192.168.99.100:2376 ::ffff:192.168.99.1:54633 ESTABLISHED 
tcp        0      0 ::ffff:192.168.99.100:2376 ::ffff:192.168.99.1:64885 ESTABLISHED 
tcp        0      0 ::ffff:192.168.99.100:2376 ::ffff:192.168.99.1:49393 ESTABLISHED

这看起来没有暴露的端口?所以也许我们诊断出这个问题???现在,需要弄清楚如何解决它......

0 个答案:

没有答案