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



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

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

如果主机是Linux,我知道各种各样的工具来解决这种情况。但当谈到Windows主机时,我不知道从哪里开始,也不知道如何一步一步地进行故障排除。

我在Windows上用-p 3999:3999启动docker,在Linux容器中,我在0.0.0.0:3999上启动一个基于Go的web服务。当主机是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

最新更新