Docker Compose file · Volumes and networks

Create separate networks

Isolate services: the proxy can reach the app, but not the database.

services:
  proxy:
    networks: [frontend]
  app:
    networks: [frontend, backend]
  db:
    networks: [backend]
networks:
  frontend:
  backend:

Official Docker Compose file documentation

More volumes and networks commands

All volumes and networks commands · Docker Compose file cheatsheet

Was this page helpful?