I created a user-defined bridge using the docker command:

docker network create --driver bridge mynetwork

This command resulted in a bridge being created, as shown by netstat -i:

Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
br-000f1  1500        0      0      0 0             0      0      0      0 BMRU

In the same way that I previously trusted the docker0 bridge, I need to add this new bridge to my firewall trust zone:

firewall-cmd --permanent --zone=trusted --add-interface=Docker0

I don't see a way to infer or specify the bridge device name, so I'm not sure how I can add it to my trust zone in an automated way.

I would appreciate any help.

  • Until an answer can be found I am adding IP networks to my trust zone instead of link devices. firewall-cmd --permanent --zone=trusted --add-source=172.16.0.0/12 – Nathan Nov 29 '17 at 8:02

Elaborating on Marek's Answer of setting the bridge name at creation time.

docker network create --driver bridge -o \
  "com.docker.network.bridge.name"="mynetwork_name" mynetwork

or if using a docker-compose file the following in the networks section

version: '3'
  .
  .
  .
networks:
  mynetwork:
    driver_opts:
      com.docker.network.bridge.name: mynetwork_name

Docker has option to set a bridge name on creation time

https://docs.docker.com/engine/reference/commandline/network_create/#bridge-driver-options

  • 1
    Please copy the important parts of the web site you linked into the answer. Links change or go dead frequently, and it would be best if this answer could continue to serve the community long after the link has died. – Todd Wilcox May 4 at 14:22

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.