Docker Community Forums

Share and learn in the Docker community.

Docker network disappears from Ubuntu routing table

Hi

I’m running docker 18.09.1 on Ubuntu 16.04.
I have created a docker network docker network create my_network of (default) type bridge. After restarting the docker service, the new network appears in the Ubuntu routing table (after typing route -n).

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 0.0.0.0         10.10.10.1      0.0.0.0         UG    100    0        0 ens6
10.10.10.0      0.0.0.0         255.255.255.0   U     0      0        0 ens6
10.10.10.1      0.0.0.0         255.255.255.255 UH    100    0        0 ens6
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.23.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-3a9a42c9e6de

In my docker compose file I add containers like so:

version: '3'
services:
    rabbit:
        hostname: rabbit
        container_name: ae_rabbit
        image: rabbitmq:3-management
        ports:
           - "15672:15672"
           - "5672:5672"
        networks:
           - my_network
    redis:
        container_name: ae_redis
        image: 'redis:3.2.7'
        ports:
           - "6379:6379"
       networks:
          - my_network
   receiver:
       image: puckel/docker-airflow:latest
       restart: always
       container_name: ae_receiver
       depends_on:
         - rabbit
         - redis
      networks:
         - my_network
  ...
networks:
    my_network:
       external: true

When developing new features I might start container docker-compose -f docker-compose.yml up redis, stop container docker stop redis or Ctrl + C in terminal, sometimes I use the --force-recreate option with docker-compose… .
At some point I notice that I can’t reach my container from the host anymore (e.g. rabbit through port 15672). I check the routing table again and the entry for my_network has disappeared. Only a service docker restart will bring the routing table entry back.

I have no idea what is going on. Why does the routing table entry disappear? What can I do to prevent that? Any help is highly appreciated. Thanks!