I am currently trying to setup my homelab using podman and hosting multiple containers on a fedora server. The backend containers shall have no internet/host access but should be able to communicate between one another based on their container names. Their services are then callable via reverseproxy (in my case nginx) that is connected to the host and the various backend containers.
Self hosted dns provides the relevant subdomain routes. Sidenote: for reasons I have to do all the podman stuff as sudo - not related to the question. Also, SELinux is active.
To achieve that I tried to create 2 networks, both of type bridge and the backend one is internal: true. Nginx is able to call the containers, the backend containers can't access the internet, but they can't reach each other. Within the backend network they are pingable, thus they are there, but name resolution fails. All docs/posts that I read so far stated that it should be possible the resolve the container names, thus what's going on? (Trying a nslookup in the backend container shows that the gateway is not reachable; but since it is on the same subnet this should work[?])
Stripped podman-compose file:
version: '3'
networks:
no-internet:
driver: bridge
internal: true
internet:
driver: bridge
services:
A:
container_name: A
networks:
- no-internet
depends_on:
- B
// Stuff related to A
B:
container_name: B
networks:
- no-internet
// Stuff related to B
proxy:
networks:
- no-internet
- internet
ports:
- 80:80
depends_on:
- A
// Stuff related to proxy
I can't reproduce that problem.
First, I converted your example
docker-compose.yamlinto something we can actually run:I'm using podman 4.5.1 and podman-compose 1.0.6
If I bring up the above environment...
It looks like name lookups work as expected:
And just to verify things, I checked and I can successfully reach the web service running in each container:
I see the same behavior in the
service2andproxycontainers.From the "backend" containers (
service1andservice2) I have no access to external sites:But this works as expected in the
proxycontainer: