我有一个在 docker 中运行的 GitLab 实例。但我无法 ping 或 curl 端口 8000。
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d31649b89354 gitlab/gitlab-ee:latest "/assets/wrapper" 16 hours ago Up 15 hours (healthy) 0.0.0.0:443->443/tcp, 0.0.0.0:2200->22/tcp, 0.0.0.0:8000->80/tcp gitlab_web_1
docker network inspect bridge
[
{
"Name": "bridge",
"Driver": "bridge",
"EnableIPv6": false,
"Containers": {
"d31649b89354209a33095536f13ac67271d5ebb632a9a2cabf41706036f139ea": {
"Name": "gitlab_web_1",
"EndpointID": "c3c3514a8eb3b9e9d3773debf39f1388179475941e8c5572c98851c3dfe262f3",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
}
},
当我尝试 ping 容器时,出现错误。
ping 172.17.0.2
PING 172.17.0.2 (172.17.0.2) 56(84) bytes of data.
From 172.17.0.1 icmp_seq=1 Destination Host Unreachable
From 172.17.0.1 icmp_seq=2 Destination Host Unreachable
From 172.17.0.1 icmp_seq=3 Destination Host Unreachable
From 172.17.0.1 icmp_seq=4 Destination Host Unreachable
但如果我运行tcpdump -i docker0
,ping 就会成功运行。