minus-squareHAMSHAMA@lemmy.sdf.orgtoSelf Hosted - Self-hosting your services.@lemmy.ml•[Question] Best way to set up docker containers that depend on other containerlinkfedilinkarrow-up2·1 year agoHello, I think you would prefer to connect via internal dns names rather than static IPs. I have a slightly similar setup with docker compose creating a network for my apps. Docker compose that creates the network: https://github.com/HugoKlepsch/reverse-proxy-network/blob/master/docker-compose.yaml Here I run my app and set the hostname. Note this app is on two docker networks, but for access from nginx it is on the “reverse_proxy” network: https://github.com/HugoKlepsch/buzz/blob/b160aab1649819acacb80964d7b19d7beb1712f6/docker-compose.yaml#L21 This compose is running nginx as a reverse proxy for my local apps. It uses the reverse proxy network: https://github.com/HugoKlepsch/reverse-proxy/blob/675e11d3d8a98e4692c6e6087de4428ac8d1ece8/docker-compose.yaml#L4 Here is a configuration file where I tell nginx where to find one of my apps on the reverse proxy docker network. Note the name references the name of the app and the docker network: https://github.com/HugoKlepsch/reverse-proxy/blob/675e11d3d8a98e4692c6e6087de4428ac8d1ece8/config/conf.d/sites-available/buzz.conf#L2 linkfedilink
Hello, I think you would prefer to connect via internal dns names rather than static IPs. I have a slightly similar setup with docker compose creating a network for my apps.
Docker compose that creates the network: https://github.com/HugoKlepsch/reverse-proxy-network/blob/master/docker-compose.yaml
Here I run my app and set the hostname. Note this app is on two docker networks, but for access from nginx it is on the “reverse_proxy” network: https://github.com/HugoKlepsch/buzz/blob/b160aab1649819acacb80964d7b19d7beb1712f6/docker-compose.yaml#L21
This compose is running nginx as a reverse proxy for my local apps. It uses the reverse proxy network: https://github.com/HugoKlepsch/reverse-proxy/blob/675e11d3d8a98e4692c6e6087de4428ac8d1ece8/docker-compose.yaml#L4
Here is a configuration file where I tell nginx where to find one of my apps on the reverse proxy docker network. Note the name references the name of the app and the docker network: https://github.com/HugoKlepsch/reverse-proxy/blob/675e11d3d8a98e4692c6e6087de4428ac8d1ece8/config/conf.d/sites-available/buzz.conf#L2