title: Network assignment to container interface
body: <p>I am trying to simulate different dynamic routing protocols by using docker. For the routers I am using the <a href="https://hub.docker.com/r/frrouting/frr" rel="nofollow noreferrer">FRRouting</a> image version 8.0.1. Clients are just simple Ubuntu images.</p>
  <p>For the different scenarios I am using different docker-compose files, which makes implementing the environment more convenient. Basically, the compose file looks something like that:</p>
  <pre class="lang-yml prettyprint-override"><code>version: &quot;3.8&quot;
  services:
    router1:
      image: frrouting/frr:v8.0.1
      ...
      networks:
        net1:
          ipv4_address: 10.1.1.1
        net2:
          ipv4_address: 10.11.0.1
        net3:
          ipv4_address: 10.12.0.1
      ...
  
  networks:
    net1:
      driver: bridge
      name: net1
      ipam:
        driver: default
        config:
          - subnet: 10.1.1.0/24
            gateway: 10.1.1.254
    ...
    net2:
      driver: bridge
      name: net2
      ipam:
        driver: default
        config:
          - subnet: 10.11.1.0/24
            gateway: 10.11.1.254
    ...
    net3:
      driver: bridge
      name: net3
      ipam:
        driver: default
        config:
          - subnet: 10.12.1.0/24
            gateway: 10.12.1.254
    ... 
  </code></pre>
  <p>Several configurations are being done on a per-interface basis. This means, that I have to make sure that e.g. <code>net1</code>is always connected to eth0. I searched through both the FRR and Docker documentation but couldn't find any information on the assignment of networks to interfaces in docker. I noticed, that the name of the network does have an influence on that. Assignment of networks to interfaces might be done in an ascending order, so that network <code>net1</code> is being assigned to eth0, <code>net2</code> to eth1 etc.</p>
  <p>I am curious if someone does know about the assignment procedure of docker or docker-compose or if there is any sort of docker-compose option, that might influence this assignment.</p>