简体   繁体   English

在本地主机之外无法访问 Docker 容器

[英]Docker Container is unreachable outside localhost

I'm running my mobile application backend server inside of a docker container (using Docker Desktop 2.4.0.0 for Windows).我在 docker 容器内运行我的移动应用程序后端服务器(使用 Docker Desktop 2.4.0.0 for Windows)。 Suddenly my backend is unreachable outside localhost, so I can't test it from my phone physically.突然间我的后端在本地主机之外无法访问,所以我无法从我的手机上进行物理测试。 Works like a charm from the host, it even works if I try to reach it via local IP from the host, but if I use the same IP on my network, it's un-reachable.就像来自主机的魅力一样,如果我尝试通过主机的本地 IP 访问它,它甚至可以工作,但是如果我在我的网络上使用相同的 IP,它就无法访问。 As far as I can tell, the only change that I made to my environment is accidentally updating Docker.据我所知,我对环境所做的唯一更改是不小心更新了 Docker。 Any help is appreciated.任何帮助表示赞赏。 Kind regards.亲切的问候。 Btw, when I run docker ps to check if the ports are forwarded correctly, the container that I want to reach is bound to 0.0.0.0.顺便说一句,当我运行docker ps检查端口是否正确转发时,我想要访问的容器绑定到 0.0.0.0。

version: "3"
services:
  db:
    image: mysql:8.0.20
    container_name: db
    ports:
      - "3306:3306"
  web:
    image: tomcat:9.0.35
    container_name: web_app
    environment:
      JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
    ports:
      - "8888:8080"
      - "8000:8000"

Check the Windows Firewall settings.检查 Windows 防火墙设置。 One of the updates may have started obeying those settings instead of bypassing them.其中一项更新可能已经开始遵守这些设置而不是绕过它们。 There was a recent report of WSL2 bypassing the firewall , so if you are using that and updated this patch Tuesday, that's a likely cause. 最近有一份关于 WSL2 绕过防火墙的报告,所以如果你正在使用它并在星期二更新了这个补丁,这很可能是一个原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM