3 ms·
I think the new network implementation in Podman 4 ("netavark") helps with that sort of thing. So the following works: [sam@isis ~]$ podman network create
by yrro 4y ago
I think the new network implementation in Podman 4 ("netavark") helps with that sort of thing.
So the following works:
[sam@isis ~]$ podman network create foo
foo
[sam@isis ~]$ podman run -d --name=host1 --network=foo --init registry.access.redhat.com/ubi9/ubi-minimal sleep inf
1f7ffa0e474f7116d782ffa4d8dd9c0454893e9dac54b2cd9e61481a7f86a2ff
[sam@isis ~]$ podman run -d --name=host2 --network=foo --init registry.access.redhat.com/ubi9/ubi-minimal sleep inf
d8ffa58cb9de77305545b9f85043c016d03193adb6543b1768a68623b044b0e5
[sam@isis ~]$ podman exec host1 getent ahosts host2
10.89.0.3 STREAM host2.dns.podman
10.89.0.3 DGRAM
10.89.0.3 RAW
[sam@isis ~]$ podman exec host2 getent ahosts host1
10.89.0.2 STREAM host1.dns.podman
10.89.0.2 DGRAM
10.89.0.2 RAW
i.e., we have a network called 'foo' to which containers 'host1' and 'host2' are attached; they can resolve each others hostnames.
It's worth noting if you are trying this on a system where you previously ran podman <= 3, I think you have to 'podman system reset' to get a new configuration with the new Podman 4 network implementation.
(Personally I just run all containers with --host=net, this is just for local development, who cares)
I think this will work with docker-compose as long as you 'systemctl --user start podman.socket' and 'export DOCKER_HOST=unix:/$XDG_RUNTIME_DIR/podman/podman.sock'.