0

TL;DR: Can a container from one Compose enviroment connect to another Compose's network?

I've got a few apps deployed by Compose that each live in its own little network, but I need to connect all frontends together to a single proxy living in a separate Compose enviroment in order to be able to route clients between the frontends according to subdomain accessed.

I've been thinking of linking frontends to the proxy's Compose network, but I don't know whether are Compose networks limited to containers in the Compose enviroment.

Example simplified version:

compose1.yml

services:
  proxy:
    build: ./proxy
    networks:
      - proxy

networks:
  proxy:
    name: proxys_network

compose2.yml

services:
  frontend:
    build: ./frontend
    networks:
      - proxy
      - app
  api:
    build: ./api
    networks:
      - app
  db:
    image: redis
    networks:
      - app

networks:
  proxy:
    name: proxys_network
    external: true
  app:
    name: apps_network
  • The two containers need to be on the same network to communicate. What you show with the `external: true` network seems like it should work. The linked question has several more examples. – David Maze Aug 28 '23 at 16:45

0 Answers0