Docker und Fedora 31

| 367 Wörter


Ahoi,

da ich seit gut 2 Jahren auf meinem Laptop (XPS 9360) Fedora am laufen habe und dies einen Releasezyklus von 6 Monaten hat, kam vor ein paar Wochen ein Upgrade auf Version 31. Dabei habe ich in den Releasenotes „übersehen“, dass jetzt cgroups-v2 zum Einsatz kommen.

Soweit so uninteressant, aber sobald man Docker benutzen möchte, wird man enttäuscht:

1
2
3
$ docker run hello-world
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:297: applying cgroup configuration for process caused \"   
open /sys/fs/cgroup/docker/9f197a12088fee3df4135045607dafe0713586b7034ff56d6dbfdca931d8ef58/cpuset.cpus.effective: no such file or directory\"": unknown.

Obwohl es schon offizielle Builds fuer F31 gibt, ist kein Vermerk in der docker Dokumentation zu genannten ` cgroups-v2` zu finden. Jedoch gibt es dazu schon ein älteres GitHub-Issue: Please provide repo for docker-ce on Fedora 31 mit einem ( unnötig umständlichen Fix): issuecomment-533998047

1
2
3
4
5
6
IDK, sorry, but users can achieve it by:  
1. open /etc/default/grub as admin  
2. Append value of GRUB_CMDLINE_LINUX with systemd.unified_cgroup_hierarchy=0  
3. sudo grub2-mkconfig > /boot/efi/EFI/fedora/grub.cfg or 
   sudo grub2-mkconfig > /boot/grub2/grub.cfg  
4. reboot

Dies lässt sich jedoch auch einfach wie folgt fixen:

1
2
3
$ sudo dnf install -y grubby
$ sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
$ sudo reboot

Wie auch in den Releasenotes vermerkt, wird durch den Kernelparameter wieder auf cgroups-v1 gesetzt und docker läuft wieder wie gewohnt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$ sudo docker run hello-world  
Hello from Docker!
This message shows that your installation appears to be working correctly.  
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
   (amd64)
3. The Docker daemon created a new container from that image which runs the
   executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
   to your terminal.  
To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash  
Share images, automate workflows, and more with a free Docker ID:  
 https://hub.docker.com/  
For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Read next

Next Post: Contact