Podman pod questions

I am playing a bit with podman on silverblue right now and i have a question about pods.

I was under the assumption that two containers can communicate with each other as long they are in the same pod.
So for example i create a new pod with containers A and B. But if i try to connect from container B to A it isnt working for me.

Is that currently a constraint for rootless podman or do i misunterstand that topic?
In Docker the above setup works as long as the containers are on the same docker network.

Yes, containers in a pod share the same network namespace, they even share the same the same loopback interface:

# Start a webserver in a new pod called 'test'
podman run -d --pod=new:test docker.io/library/nginx:latest 
# Run a second curl container in the same pod
podman run --rm -it --pod=test registry.fedoraproject.org/fedora:30 curl http://localhost

Rootless podman uses slirp4netns. This allows rootless containers to expose ports on the host. You can also start a container in the same network namespace as an existing container using --net container:<name/id>.

$ podman run -d --name nginx docker.io/library/nginx:latest
$ podman run --rm -it --net container:nginx registry.fedoraproject.org/fedora:30 curl http://localhost

As far as networking goes, this will give you the same behavior as having 2 containers in the same pod.

Thank you very much for the example.

I tried it a few times with a mariadb container and a php container in one pod but could never connect to the mariadb instance from the php container because i wanted to use the name of the mariadb container (like it is possible with docker-compose) to connect instead of localhost like in your example.
When i used localhost:3306 as dbhost it instantly worked