首页 > 解决方案 > Docker 端口映射主机未侦听

问题描述

我有一个 docker 容器,其中端口映射不再起作用。在主机上:

3b0d28970e58        docker.software-univention.de/zammad-zammad-nginx:3.6.0-42           "/docker-entrypoint.…"   24 minutes ago      Up 3 minutes        0.0.0.0:40001->80/tcp   zammad_zammad-nginx_1
curl http://127.0.0.1:40001
curl: (56) Recv failure: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt 

curl http://172.16.0.249:40001
curl: (7) Failed to connect to 172.16.0.249 port 40001: Keine Route zum Zielrechner

ping 172.16.0.249
PING 172.16.0.249 (172.16.0.249) 56(84) bytes of data.
64 bytes from 172.16.0.249: icmp_seq=1 ttl=64 time=0.041 ms

nmap -sS 172.16.0.249

Starting Nmap 7.40 ( https://nmap.org ) at 2021-06-19 21:02 CEST
Nmap scan report for ucs-intranet.redacion.net (172.16.0.249)
Host is up (0.000018s latency).
Not shown: 992 closed ports
PORT      STATE SERVICE
... no 40001 entry in list

netstat -tulpen | grep 40001
tcp6       0      0 :::40001                :::*                    LISTEN      0          1019188    18819/docker-proxy

nmap -6 -sS ::1

Starting Nmap 7.40 ( https://nmap.org ) at 2021-06-19 21:10 CEST
Nmap scan report for localhost (::1)
Host is up (0.000028s latency).
Not shown: 993 closed ports
PORT      STATE SERVICE
... no 40001 entry in list

curl http://[::1]:40001
curl: (56) Recv failure: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt

ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.068 ms

在码头集装箱中

curl http://127.0.0.1:80
<!DOCTYPE html>
curl http://172.16.0.6:80
<!DOCTYPE html>
...

有谁知道这里有什么问题?操作系统是最新的 UCS 4(基于 Debian)。

此致,

亚历克斯

标签: dockerportforwarding

解决方案


推荐阅读