【问题标题】:Provide services from within docker container to host under Windows从 docker 容器内提供服务到 Windows 下的主机
【发布时间】:2020-08-02 03:04:00
【问题描述】:

继续Docker host network container service access under Windows

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

如果主机是 Linux,我知道用于排除故障的一整套工具。但是对于Windows主机,我不知道从哪里开始以及如何逐步排除故障。

我在 Windows 上使用 -p 3999:3999 启动 docker,并在 Linux 容器中启动基于 Go 的 Web 服务,侦听 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

【问题讨论】:

    标签: linux docker networking service debian-based


    【解决方案1】:

    我也有同样的情况。我在centos 8的容器中部署了react服务。我试图访问该服务的主机是windows。我无法从我的 Windows 主机浏览器访问该服务。停止防火墙对我有用。

    systemctl stop firewalld
    systemctl restart docker
    

    【讨论】:

    • 感谢Bhargav11的回复,我的Linux端没有问题,因为我没有安装防火墙。请参阅更新的 OP。无论如何,谢谢,赞成!
    猜你喜欢
    • 2020-11-22
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-27
    相关资源
    最近更新 更多