Local Network Breaks with Custom Network Driver Bridge

I KNOW this is going to be a user error in the end, but I’m not sure what I’m doing wrong :laughing:

I have a local ip of 172.18.4.0/22. Using VMware Workstation I install Ubuntu desktop 24.04.2 with my network set to NAT in VMWare I can ping my host and local subnet.

I install Docker and can still ping my local subnet, no worries.

I spin up a container using docker-compose.yaml with a custom network (mynetwork) and set driver: bridge. in that network.

As soon as I do this my Ubuntu VM and containers can no longer ping my host or local subnet. My assumption is that I have a routing issue going on, maybe a default IP range of the bridge I’m creating conflicting with my local subnet?

How do I resolve this issue so my Ubuntu VM and containers can once again reach my local subnet? Here’s the docker-compose.yaml file I’m using

version: '3.8'
name: p_gas
services:
  ignition:
    image: inductiveautomation/ignition:latest
    ports:
      - 9088:8088 # Ignition Gateway
    volumes:
      - ./ignition_data1:/var/lib/ignition/data
    environment:
      - TZ=America/Chicago
    networks:
      - mynetwork
  database:
    image: postgres:latest
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: postgres # The PostgreSQL user (useful to connect to the database)
      POSTGRES_PASSWORD: password # The PostgreSQL password (useful to connect to the database)
      POSTGRES_DB: default_database # The PostgreSQL default database (automatically created at first launch)
    networks:
      - mynetwork
networks:
  mynetwork:
    driver: bridge

I updated your docker.compose by adding the ipam section

Updated `docker-compose.yaml

version: '3.8'
name: p_gas
services:
  ignition:
    image: inductiveautomation/ignition:latest
    ports:
      - 9088:8088 # Ignition Gateway
    volumes:
      - ./ignition_data1:/var/lib/ignition/data
    environment:
      - TZ=America/Chicago
    networks:
      - mynetwork
  database:
    image: postgres:latest
    ports:
      - 5432:5432
    environment:
      POSTGRES_USER: postgres # The PostgreSQL user (useful to connect to the database)
      POSTGRES_PASSWORD: password # The PostgreSQL password (useful to connect to the database)
      POSTGRES_DB: default_database # The PostgreSQL default database (automatically created at first launch)
    networks:
      - mynetwork
networks:
  mynetwork:
    driver: bridge
    ipam:
      config:
        - subnet: 192.168.100.0/24
1 Like

I knew it was a user error issue, lol. Thanks! Right as you posted this, I was also able to figure out that I could fix it by changing the default bridge ip.
In Ubuntu this required me to make /etc/docker/daemon.json and enter the following:

{
  "default-address-pools":
  [
    {"base":"10.10.0.0/16","size":24}
  ]
}

In Windows in Docker Desktop I went to settings then docker engine and made my config look like this:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "default-address-pools": [
    {
      "base": "10.10.0.0/16",
      "size": 24
    }
  ],
  "experimental": false
}

Once I changed my default bridge IP and recreated my containers I could reach my local subnet again!

And it also explains why in Linux it broke my ability to talk to the local subnet. In it’s mind the 172.18 subnet needed to be routed to my docker bridge. :man_facepalming:

1 Like

Kindly give my comment a likes and mark the issue has resolved

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.