You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何获取Podman容器IP?解决跨容器连接PostgreSQL问题

WSL2环境下Podman容器pgAdmin连接PostgreSQL的IP问题解决

问题场景

尝试使用独立容器运行的pgAdmin连接另一容器内的PostgreSQL数据库,通过podman inspect命令查询PostgreSQL容器IP时,返回的IPAddress字段为空:
执行命令:

$ podman inspect serene_lovelace | grep -i ipaddress

返回结果:

"IPAddress": "",

解决方法

实际需要使用WSL2实例的IP作为数据库连接地址,获取该IP的命令如下:

ip addr | grep 172

返回示例:

inet 172.26.240.194/20 brd 172.26.255.255 scope global eth0

提取返回结果中的IP地址(如上述示例中的172.26.240.194),在pgAdmin的数据库连接配置中填入该地址即可完成连接。

内容的提问来源于stack exchange,提问作者Topaz Rindu Nabiyallah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 16:10:33