I have 2 different containers running on my server(app and web_server). They are in the same network, because I put them in the same network and that network's driver is bridge.
networks:
app-network:
driver: bridge
Now, I have 3rd container, which needs to connect one of the 2 containers I mentioned. I try to connect from 3rd container to 1st container like this: app:9000 , but it says host not found. I guess this is because they are in different networks. What should I do to make it work?
You need both containers join the same network. either by creating a new network and make then join it or one of them join the other container's network.
the docker-compose.yml where you have
container1
andcontainer2
:container3
the docker-compose.yml where you have
container3
will be a normal docker-compose with a bridge network.