Skip to content

Instantly share code, notes, and snippets.

@sunsided
Created February 29, 2020 13:48
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunsided/7840e89ff4e11b64a2d7503fafa0290c to your computer and use it in GitHub Desktop.
Save sunsided/7840e89ff4e11b64a2d7503fafa0290c to your computer and use it in GitHub Desktop.
WIFIonICE vs Docker: Fixing DB (Deutsche Bahn) WIFI by moving Docker away from 172.18.x.x in /etc/docker/daemon.json
{
"bip": "172.39.1.5/24",
"fixed-cidr": "172.39.1.0/25",
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
}
}
@sunsided
Copy link
Author

sunsided commented Feb 29, 2020

So DB's WIFIonICE uses 172.18.x.x addresses. Sadly, this is also the default docker0 network for Docker, which interferes with both login to the network, as well as routing later on. By moving Docker away to a different subnet using bip and fixed-cidr options in /etc/docker/daemon,json, this problem can be worked around.

If you already created different networks before either using docker network or implicitly via docker-compose, make sure to delete them (e.g. docker network rm br-1234567)

@arne-cl
Copy link

arne-cl commented Oct 1, 2021

Unfortunately, this did not work for me. Afterwards, docker did not run at all until I realised that /etc/docker/daemon.json must either

@sunsided
Copy link
Author

sunsided commented Oct 1, 2021

@arne-cl Just to clarify: changing the bip and fixed-cidr subnet ranges didn't work? For the fix, the file is assumed to stay identical otherwise.

@arne-cl
Copy link

arne-cl commented Oct 4, 2021

Dear @sunsided,
I deleted existing networks with docker network rm ... first, then saved your snippet verbatim in /etc/docker/daemon.json (I didn't have that file before).

Afterwards, docker wouldn't work, i.e.

docker run hello-world
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.

Running sudo systemctl restart docker.service didn't help either. I also tried it without the nvidia part:

{
    "bip": "172.39.1.5/24",
    "fixed-cidr": "172.39.1.0/25"
}

but the result was the same.

@henningsway
Copy link

it just worked for me, thanks!

@malte-j
Copy link

malte-j commented May 6, 2022

Removing all networks first and leaving out the Nvidia config worked for me, thanks!

@orzechow
Copy link

orzechow commented Apr 4, 2023

With the above solution, each time when connecting to WIFIonICE I was forced to remove networks created by docker compose again – which invalidated images and lead to running docker prune way too often…

This works for a couple of months now, without the need to prune networks each time (only once after initial setup):

/etc/docker/daemon.json

{
    "bip": "172.39.1.5/24",
    "fixed-cidr": "172.39.1.0/25",
    "default-address-pools":
    [{
        "base": "172.39.0.0/16",
        "size": 24
    }],
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}

@NiklasMM
Copy link

NiklasMM commented Apr 28, 2023

Doesn't work for me =(

The address for docker0 complies, but the br-<somethin> networks continue to use the 172.18.x.x range

Docker version 23.0.4, build f480fb1

Edit:

Ok, just got it working by running docker network prune. Networks created after that will use the new range

@orzechow
Copy link

Nice! 🚀

@leonp5
Copy link

leonp5 commented Jul 17, 2023

I had to delete all already existing container and images. After i did that, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment