buildah 中的暴露端口如何工作

buildah 中的暴露端口如何工作

我有 Windows 8.1 操作系统,安装了 vmware 工作站,运行 rhel8 服务器作为来宾操作系统。在 rhel8 服务器中,我正在从现有的 tomcat 容器构建图像,如下所示

[root@rhelser8 ~]# buildah from docker.io/library/tomcat
Getting image source signatures
...
Writing manifest to image destination
Storing signatures
tomcat-working-container

通过文档中所示的上述步骤,我得到了“tomcat-working-container”,我正在尝试运行它,如下所示

[root@rhelser8 ~]# buildah run tomcat-working-container catalina.sh run

因此,我可以启动 tomcat 容器并从主机 rhelser8 的另一个终端访问它,如下所示

[root@rhelser8 ~]# curl http://localhost:8080/
[root@rhelser8 ~]# curl http://IP_address:8080/

但是当我从 Windows 主机访问第二个 url 时,我无法访问 tomcat 默认页面。

但是如果我使用以下命令使用 podman 运行容器映像

[root@rhelser8 ~]# podman run -it -d -p 8888:8080 container_image

我能够从我的 Windows 主机和 rhel8 主机访问第二个 url,即 url -http://IP 地址:8080/

我想要理解的是,当使用 buildah 时,我可以使用 rhel8 主机的 hostip 访问该页面,但不能从 windows 主机访问该页面

但是,如果我使用 podman 并使用 -pi 发布端口,我可以从 rhel8 主机以及 Windows 主机访问该页面

我需要理解这种行为。

相关内容