0

操作系统:Ubuntu 20.04 LTS

Docker 版本 20.10.7,构建 20.10.7-0ubuntu1~20.04.2

试过这个(最小的重现方式),前一天它正常工作:

docker run --name nginx1 -p 8089:80 -d nginx:alpine

正常工作:

docker ps

CONTAINER ID   IMAGE          COMMAND                  CREATED         
74faabf44b8e   nginx:alpine   "/docker-entrypoint.…"   5 minutes ago   

STATUS         PORTS                                       NAMES
Up 5 minutes   0.0.0.0:8089->80/tcp, :::8089->80/tcp       nginx1

curl码头工人内部工作:

docker exec -it 74faabf44b8e sh

/ # curl localhost
<!DOCTYPE html>
<html>
<head>
....

但是当从主机访问时:

netstat -antpel | grep 8089
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8089            0.0.0.0:*               LISTEN      0          82748695   -                   
tcp6       0      0 :::8089                 :::*                    LISTEN      0          82751546   - 

curl -v localhost:8089
*   Trying 127.0.0.1:8089...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8089 (#0)
> GET / HTTP/1.1
> Host: localhost:8089
> User-Agent: curl/7.68.0
> Accept: */*
> 
--> stuck without a response, after a while:
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

这可能是什么原因?
这也不适用于另一个容器(PostgreSQL),似乎 docker-proxy 没有转发来自 docker 的响应?

已经尝试过:

  • 重新安装 docker.io
  • 删除所有容器并重新创建
  • 码头工人网络修剪
4

0 回答 0