Dockerd: start-up error "no available network"

How do you disable the auto-detection which causes the error “no available network” when starting dockerd? I have tried specifying the network I want to use with the --bip option but it didn’t work.

Ubuntu 18.04 x86_64
docker 17.12.1

To reproduce use these steps:

1.Reinstall docker. (Should remove /var/lib/docker/network/files/local-kv.db where the network settings seem to be stored.)

2.Add these routes:

ip route add unreachable 
ip route add unreachable

Start dockerd:

# dockerd --bip
Error starting daemon: Error initializing network controller: list bridge addresses failed: no available network

Edit: A workaround is to run docker in it’s own isolated network namespace for example using systemd-named-netns. This means docker will not be confused with the routes since it will see the default route only (and the network used on the link between the docker and primary network namespaces.)