Docker-Compose in Development - Managing Subnets


I’m currently using Docker-Compose for development with a small team of people (8). I’ll describe the setup and scenario we currently are facing.

We have a single project checked into our VCS. Devevelopers check this out and do a “docker-compose up”, all on a single host, but in home folders. This creates a default network (prefixed with their username and project name) and automatically assigns a subnet to the new default network (So far, so docker-compose). This is great for us as it isolates the development environments from each other, and allows us to use the named services to access our databases, etc in our Compose files - all without stepping on toes and developers don’t need to configure anything manually.

The snag is; this default network has an ever incrementing subnet of 172.*.0.0. This is fine until we reach subnets that are currently in use on our corporate network. For example: our VPN uses We have about 4 or 5 of these subnets that we will create access problems with once we hit them when enough developers fire up the stacks.

How do other people manage this situation for development with Docker Compose?

Essentially, we have many hosts running Docker, with many different applications and many developers on each application. Defining a single subnet in the compose files; per user; per application (to ensure all subnets are unique, regardless of host) would become an absolute nightmare to manage and likely become an exercise in spreadsheet management.

I can’t even find a way of enforcing Docker-Compose to use a different subnet range, such as etc - which would be fine on our corporate network.

Any help with this kind of configuration would be appreciated. Surely others use Docker-Compose to create development environments?


Have you tried using something like this in your docker-compose.yml?

    driver: overlay
      driver: default
      - subnet: