moby / moby

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
https://mobyproject.org/
Apache License 2.0
68.11k stars 18.58k forks source link

Cannot create new containers #47824

Open zuavra opened 1 month ago

zuavra commented 1 month ago

Description

Containers fail to be created with error "The name org.freedesktop.systemd1 was not provided by any .service files: unknown."

Reproduce

  1. Attempt to run simple container:
    docker run -it alpine:latest /bin/bash

Result:

docker: Error response from daemon:
failed to create task for container:
failed to create shim task:
OCI runtime create failed:
runc create failed:
unable to start container process:
unable to apply cgroup configuration:
unable to start unit "docker-dbca1b8fbda8c60112b21749745e5a84827b4fd918722493daef5298c2cc5785.scope"
(properties [
  {Name:Description Value:"libcontainer container dbca1b8fbda8c60112b21749745e5a84827b4fd918722493daef5298c2cc5785"} 
  {Name:Slice Value:"system.slice"}
  {Name:Delegate Value:true}
  {Name:PIDs Value:@au [25596]}
  {Name:MemoryAccounting Value:true}
  {Name:CPUAccounting Value:true}
  {Name:IOAccounting Value:true}
  {Name:TasksAccounting Value:true}
  {Name:DefaultDependencies Value:false}
]): The name org.freedesktop.systemd1 was not provided by any .service files: unknown.

Expected behavior

Docker should create a container using the provided image.

docker version

Client: Docker Engine - Community
 Version:           26.1.2
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        211e74b
 Built:             Wed May  8 13:59:59 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.1.2
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.10
  Git commit:       ef1912d
  Built:            Wed May  8 13:59:59 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.31
  GitCommit:        e377cd56a71523140ca6ae87e30244719194a521
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client: Docker Engine - Community
 Version:    26.1.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 23
  Running: 21
  Paused: 0
  Stopped: 2
 Images: 21
 Server Version: 26.1.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e377cd56a71523140ca6ae87e30244719194a521
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-21-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 30.93GiB
 Name: nas
 ID: bf325a34-c632-4957-b2f8-dbb8eb3937e1
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

I am running docker as root (rootful mode).

I do not have an /etc/docker/daemon.json config file.

zuavra commented 1 month ago

If I populate /etc/docker/daemon.json with the following:

{
  "exec-opts": ["native.cgroupdriver=cgroupfs"]
}

Then the errors go away and I am able to create containers normally as expected. So it would seem the problem only affects systemd cgroups (v2).