Small reminder for myself that should not just stay as a comment in one of the projects at work: the ability to name networks was added/finalized in the v3.5 docker compose schema. Like so:
But Ru, couldn’t I already do this in the v2.x schema?
Between version 2 and version 3 of the compose-file schema, here’s what the Docker docs say (emphasis mine):
Designed to be cross-compatible between Compose and the Docker Engine’s swarm mode, version 3 removes several options and adds several more.https://docs.docker.com/compose/compose-file/compose-versioning/#version-3
Naming networks is also allowed starting version 2.1 of the schema.
You can use whichever one you like between 2.1+ and 3.5+, even if just using compose and not the swarm mode. Unless you have some specific reason to be using the other one.