nginx on docker:对等方重置连接
OS:Manjaro KDE;Docker版本:19.03.12-ce 试图寻找类似的问题,但没有任何帮助 在docker或任何其他容器上运行nginx时,我无法访问它nginx on docker:对等方重置连接,docker,nginx,Docker,Nginx,OS:Manjaro KDE;Docker版本:19.03.12-ce 试图寻找类似的问题,但没有任何帮助 在docker或任何其他容器上运行nginx时,我无法访问它 $ docker run -p 80:80 nginx $ curl -vvv localhost * Trying ::1:80... * Connected to localhost (::1) port 80 (#0) > GET / HTTP/1.1 > Host: localhost > User
$ docker run -p 80:80 nginx
$ curl -vvv localhost
* Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.71.1
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
以下是netstat输出的相关部分:
$ sudo netstat -pnltu | grep 80
tcp6 0 0 :::80 :::* LISTEN 80884/docker-proxy
我还尝试:
$ docker run -p 127.0.0.1:80:80 nginx
这将导致netstat:
$ sudo netstat -pnltu | grep 80
tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN 81440/docker-proxy
同样的结果。但是,如果我这样运行它:
$ docker run --network host -p 80:80 nginx
它按预期工作。知道为什么吗?我知道了
罪魁祸首是我(mullvad)的wireguard配置,它将自己的iptables规则添加到主机,以实现kill交换机,迫使整个流量通过VPN,或者丢弃它
如果有人经历过类似的事情,请检查您的iptables
PostUp = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT && ip6tables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
我也有同样的问题。通过
mullvad lan set allow允许本地网络访问解决了这个问题。