How to configure custom docker compose network

Hello,

I need to setup a custom docker network, but I cant figure out how to 'attach' it to the docker0 an interface.

I am launching my services from a docker compose file, and the services launch fine. However, openWrt seems to make a unique bridge br-xxxyyyzzz each time the compose is brought up. The name of the bridge appears to be a unique hash and is constructed/deconstructed on up/down, so i cannot simply add it ito the docker0 bridge because its name will be different next time.

How do we setup a custom docker network in openWrt?

Hi, you have to pre-init empty_bridge called docker0, then dockerd adapts it as docker bridge.

docker0 bridge is already there.

problem is the default docker bridge doesnt support DNS for inter-container communication. ( see here: https://docs.docker.com/network/drivers/bridge/#differences-between-user-defined-bridges-and-the-default-bridge)

...so... I need to create a custom network in order for one container to connect to another by its docker-compose service name.

i can create a docker network with either cli or luci, but I dont see any options to assign it to a "parent interface", as the default one is:

When i run docker compose up, docker creates a new network for my compose stack as expected, but its completely inaccessible because i cannot add it to a firewall zone (because it doesnt have a parent interface that luci can assign to a zone?)

With the help of the following links:

I got it to work with the following:

  1. add a custom network to my docker-compose.yml file. They key is com.docker.network.bridge.name: docker1 (name it whatever you want i suppose):
networks:
  mxi_default:
    name: mxi_default
    driver: bridge
    driver_opts:
      com.docker.network.bridge.name: docker1
  1. add an interface in luci, covering the device1 specified in com.docker.network.bridge.name: docker1 from docker-compose.yml:

  2. add the new interface to docker firewall zone:

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