We had an issue where one site could not communicate with the intranet server. The intranet server is an apache2 instance in a Docker container and was assigned the network pool of 192.168.0.0/20 automatically when it was created. Whereas the local network, in this case, had the subnet 192.168.5.0/24, obviously this will cause an issue for routing the traffic. The permanent fix is to make sure that Docker assigns subnets outside of your local subnet addresses.

  1. Open daemon.json:
    nano /etc/docker/daemon.json
  2. Add the entry below substituting your desired address range:
    {
      "default-address-pools" : [
        {
          "base" : "172.240.0.0/16",
          "size" : 24
        }
      ]
    }
  3. Restart Docker for the change to take effect:
    systemctl restart docker
  4. All of your currently configured networks will remain, this will only have an impact on newly created containers.
  5. Of course, you will still need to address and remove the conflicting network. In my case, I used docker-compose so I simply had to run the commands below. The first command will tear down the container, including the network. The second will rebuild it.
    docker-compose down
    docker-compose up -d
Fix Docker Network Pool Conflicts With Local Subnets

You May Also Like

Leave a Reply

Your email address will not be published. Required fields are marked *