Skip to content

Instantly share code, notes, and snippets.

@shadowandy
Created September 13, 2025 09:10
Show Gist options
  • Select an option

  • Save shadowandy/6b9248918b60e442a62cdb74bcf97b21 to your computer and use it in GitHub Desktop.

Select an option

Save shadowandy/6b9248918b60e442a62cdb74bcf97b21 to your computer and use it in GitHub Desktop.
Setting default address pool for Docker containers' network

New docker container networks often take quite a sizable address pool /8 or 255.0.0.0.

New networks takes addresses like 172.18.0.0/8 and 172.19.0.0/8 which are often excessive for home use.

The default address pool can be changed via the daemon configuration file for Linux Docker.

To configure it, create or edit the configuration file at /etc/docker/daemon.json

{
  "bip": "172.17.0.1/16",
  "default-address-pools": [
    {
      "base": "172.19.0.0/16",
      "size": 24
    },
    {
      "base": "172.20.0.0/16",
      "size": 24
    }
  ]
}

What it does is to set the network for the default bridge bip to 172.17.0.1/16. It also set the network range (default-address-pool) for use by the containers' local network to 172.19.0.0/16 and 172.20.0.0/16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment