Customizing Docker Bridge Subnet


Problem: Docker's internal bridge network (eg 172.18.X.X) conflicts with your LAN.

Solution: Change the default docker bridge network to meet your needs.


You have root on the A3 host (sudo password is your "alike" password) so you can make arbitrary Docker configuration changes.

Your docker-compose.yml is configured to use the alike-net network, which is defined to use the driver "bridge":

networks:

  alike-net:

    driver: bridge


Docker bridges are discussed in this section of the docker documentation here:

https://docs.docker.com/network/bridge/


To that to override defaults, you simply create a new file:

/etc/docker/daemon.json

and populate it with the JSON data discussed in the documentation above that lets you set a different subnet.


Example daemon.json:

{
  "bip": "192.168.1.1/24",
  "fixed-cidr": "192.168.1.0/25",
  "mtu": 1500,
  "default-gateway": "192.168.1.254",
  "dns": ["10.20.1.2","10.20.1.3"]
}


If you are comfortable with Linux, the A3 Alpine VM ships with vi and you can type

sudo vi /etc/docker/daemon.json


to create and edit this file.

If you are not comfortable with vi, you can use nano instead, which is a bit more user-friendly:

sudo apk update

sudo apk add nano

sudo nano /etc/docker/damon.json

then, simply paste in the JSON above, make modifications for your network specifics, and then save.