Cannot use container name in default bridge mode and docker-compose

Hi all,
I have recently setup my home media server on raspberry pi using a lot of the docker images I found here. First of all thanks a lot :slight_smile:
Now for my small problem, I have no idea why but I have created a single docker compose file with 7 services but for some reason they cannot communicate with each other using their container name under the default bridge network.
To fix it I had to create a new network and to manually attach them to the new network.

Any idea why the default network is not working? It is bothering me because I still play with the docker images and after redeploy it might fallback to the default one and then I have to fix it again manually.
I have also tried to define the network inside the docker compose as external and to define a new network but it did not work as I got some errors (from reading it is probably for using portainer).

I am using raspberry pi 4 with openmediavault and portainer if it helps

Thanks in advance!

The default docker bridge is not supposed to resolve container names, it is just how it is set up.

Did you override the network compose creates in your attempt?

From the documentation: "SWAG container happily runs with bridge networking. However, the default bridge network in docker does not allow containers to connect each other via container names used as dns hostnames. Therefore, it is recommended to first create a user defined bridge network and attach the containers to that network.

If you are using docker-compose, and your services are on the same yaml, you do not need to do this, because docker-compose automatically creates a user defined bridge network and attaches each container to it as long as no other networking option is defined in their config."

This is why I am expecting it to work.
But I did notice something that might lead to the reason, I noticed that on some other docker-compose stack I created, it is also creating a “default network” for this stack.
For some reason on my main docker-compose it does not create a new user defined network and attach all my dockers to the default one. :\

This is likely going to be your issue. If you’re using docker-compose snippets within portainer, it’s likely it’s not performing as you expect it to because it’s not actually docker-compose it’s using.

Portainer on arm devices uses horrendously out of date “compose-like” library which causes more problems than it’s worth. Our recommendation is to always use docker-compose via ssh for a happy experience.

Portainer is fine if you want to monitor containers we don’t recommend using it for deployment.