简体   繁体   English

如何在无根 podman 中发布用户定义网络中的端口?

[英]How to publish ports in user defined network in rootless podman?

I'm trying to publish ports to host from the container, but it does not work when the container is being run with the user defined network.我正在尝试从容器发布端口到主机,但是当容器与用户定义的网络一起运行时它不起作用。 See below:见下文:

$ podman network create samplenet
$ podman network ls              
NAME       VERSION  PLUGINS
samplenet  0.4.0    bridge,portmap,firewall,tuning,dnsname
$ podman run -dt --name test --network=samplenet --rm --publish 8080:80 nginx
$ podman port -l   
80/tcp -> 0.0.0.0:8080
$ curl localhost:8080
curl: (56) Recv failure: Connection reset by peer

I've noticed that network mode for containers without network specified is slirp4netns , but when I specify a network it is changed to: bridge .我注意到没有指定网络的容器的网络模式是slirp4netns ,但是当我指定一个网络时,它会更改为: bridge

How can I expose ports from the container and connect it to the user-defined network in rootless mode?如何从容器中公开端口并以无根模式将其连接到用户定义的网络?

That's a bug in podman 3.0.1.这是 podman 3.0.1 中的一个错误。 Fixed in 3.1.0.在 3.1.0 中修复。

https://github.com/containers/podman/issues/9532 https://github.com/containers/podman/issues/9532

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

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