我敢肯定这是被问了一百万次,但我只是在网上找不到任何原因。
我用Podman创建了两个网络(类似于Docker)。
当我做localhost:9998时,它就会超时。
所以它就是联系不上。
是否有一种方法来创建网桥,以便我可以在一个特定的容器网络中卷曲我的容器?
[
{
"cniVersion": "0.4.0",
"name": "search",
"plugins": [
{
"bridge": "cni-podman0",
"ipMasq": true,
"ipam": {
"ranges": [
[
{
"gateway": "10.89.0.1",
"subnet": "10.89.0.0/24"
}
]
],
"routes": [
{
"dst": "0.0.0.0/0"
}
],
"type": "host-local"
},
"isGateway": true,
"type": "bridge"
},
{
"capabilities": {
"portMappings": true
},
"type": "portmap"
},
{
"backend": "iptables",
"type": "firewall"
}
]
}]
发布于 2019-11-02 16:32:01
您可以使用podman inspect <container-name>获取容器的IP地址。
这里的命令只返回IP地址:
podman inspect <container-name> --format '{{.NetworkSettings.IPAddress}}'发布于 2019-11-02 13:45:43
从我正在阅读的内容来看,我需要从podman network inspect search获得网关IP。
数字为: 10.89.0.1
当我卷起那个IP的时候,它还是不起作用。
但后来我在IPtables上找到了这个:
Chain INPUT (policy DROP)
...
Chain FORWARD (policy ACCEPT)
target prot opt source destination
CNI-FORWARD all -- anywhere anywhere /* CNI firewall plugin rules */
Chain OUTPUT (policy ACCEPT)
...
Chain CNI-FORWARD (1 references)
target prot opt source destination
...
ACCEPT all -- anywhere 10.89.0.20 ctstate RELATED,ESTABLISHED
ACCEPT all -- 10.89.0.20 anywhere
ACCEPT all -- anywhere 10.89.1.2 ctstate RELATED,ESTABLISHED
ACCEPT all -- 10.89.1.2 anywhere
...IP 10.89.0.20和10.89.1.2是我的主机能够访问每个podman网络的IP。
https://serverfault.com/questions/990302
复制相似问题