繁体   English   中英

提供从 docker 容器到宿主在 Windows 下的服务

[英]Provide services from within docker container to host under Windows

继续用Docker 主机网络容器服务访问 Windows 下

我很难尝试在 Linux 容器(即它们的端口)中公开服务,以便可以直接从主机访问它们。

如果主机是 Linux,我知道一整套解决问题的工具。 但是说到Windows主机,我不知道从哪里开始,如何一步步排除故障。

I'm starting docker with -p 3999:3999 on Windows, and within the Linux container I'm starting a Go based web service listening on 0.0.0.0:3999 . 当主机是 Linux 时,这些是我一直在做的事情,没有任何问题。 现在唯一的区别是,

  • 主机现在是 Windows
  • 它可能没有任何关联,但 Windows 使用的是公司的透明代理。

如何逐步排除故障?

更新:

我没有安装防火墙——

% iptables -L
-bash: iptables: command not found

% sudo iptables -L
sudo: iptables: command not found

% ufw status
-bash: ufw: command not found

% dpkg -l | grep fire || echo no firewall  found
no firewall found

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux bullseye/sid
Release:        testing
Codename:       bullseye

我也有同样的情况。 我在 centos 8 的容器中部署了 react 服务。我尝试访问该服务的主机是 windows。 我无法从我的 windows 主机浏览器访问该服务。 停止防火墙为我做了这件事。

systemctl stop firewalld
systemctl restart docker

暂无
暂无

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

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