Linux: `docker network create` without an explicit subnet always fails with "no free subnet left" (breaks kind)

Aperta
#228 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, linux, rust

Direzione di ricerca

Start by tracing the Linux engine's Docker network creation and automatic subnet allocation path; the issue does not name source files or tests. Reproduce with docker network create probe4 and with the IPv6-only pinned subnet command, then compare against explicit IPv4 subnet creation. Done means automatic allocation selects a free subnet and the reported kind network command succeeds.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Kiri version and system

0.2.0 (kiri-desktop-bin from the AUR) on CachyOS (Arch Linux), kernel 7.3.4-1-cachyos, systemd 262. Native Linux engine, no VM.

What you did

Create a network without specifying a subnet (the normal case):

$ docker --context kiri network create probe4

Variants that fail the same way: docker network create --ipv6 --subnet fc00:f853:ccd:e793::/64 probe6 (IPv6 pinned, IPv4 left to the pool — the exact command kind runs), and a plain docker network create test.

What happened
Error response from daemon: no free subnet left

This is with plenty of the default pool free. At the moment of the commands above, the host had these 172.16/12 addresses in use: 172.17.0.1/16 (docker0), 172.18.0.1/16 (an old bridge), 172.19.0.1/16 (kiri0) — everything from 172.20 upward was free.

Creating a network with an explicit --subnet works fine:

$ docker --context kiri network create probeA --subnet 172.22.0.0/16
4e20e6092921e57b1545a53f41abd8813e5e4ab4b0b54a66736bae95e7bb0709

So only the automatic pool allocation is broken, not network creation itself.

What you expected instead

Docker Engine allocates the next free subnet from the default address pool (172.17.0.0/12 in /16s, then 192.168.x): docker network create probe4 succeeds and picks e.g. 172.20.0.0/16.

Anything else

Happens 100% of the time on this machine.

This breaks kind out of the box: kind v0.27 creates its network as docker network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true --ipv6 --subnet fc00:f853:ccd:e793::/64 kind, i.e. with the IPv4 subnet left to the pool, so every kind create cluster fails with "no free subnet left".

Workaround I'm using: pre-create the network with explicit subnets before kind runs — kind finds a network named kind and reuses it:

$ docker --context kiri network create -d=bridge -o com.docker.network.bridge.enable_ip_masquerade=true --ipv6 --subnet fc00:f853:ccd:e793::/64 --subnet 172.20.0.0/16 kind

Related: #125 (Docker network compatibility).

Lingua principale
Rust
Stelle
7.5k
Fork
329
Merge medio
7h 48m
PR unite (30g)
105

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di libracoder/kiri

Tutte le issue di libracoder/kiri

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.