Skip to content

Docker rootless / cgroups2: Read-only filesystem #581

Closed
@PentaPaetzold

Description

I would like to run freeipa in docker rootless mode, but am stuck at cgroups v2.

freeipa-1  | Configuration file /etc/systemd/system.conf is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
freeipa-1  | Configuration file /usr/lib/systemd/system.conf.d/ipaplatform-override.conf is marked world-inaccessible. This has no effect as configuration data is accessible via APIs without restrictions. Proceeding anyway.
freeipa-1  | systemd 252-18.el9 running in system mode (+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS -FIDO2 +IDN2 -IDN -IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
freeipa-1  | Detected virtualization container-other.
freeipa-1  | Detected architecture x86-64.
freeipa-1  | Failed to create /init.scope control group: Read-only file system
freeipa-1  | Failed to allocate manager object: Read-only file system
freeipa-1  | [!!!!!!] Failed to allocate manager object.
freeipa-1  | Exiting PID 1...
freeipa-1 exited with code 0

I read #429 (comment) and the thread #429 .

My system is cgroups v2 - so it seems, that { "userns-remap": "default" } should be the answer. But adding this to daemon.json, gives:

dockerd-rootless.sh[822]: time="2024-01-19T12:35:01.594279045+01:00" level=warning msg="Running experimental build"
dockerd-rootless.sh[822]: time="2024-01-19T12:35:01.594290437+01:00" level=warning msg="Running in rootless mode. This mode has feature limitations."
dockerd-rootless.sh[822]: could not create or set daemon root permissions: /srv/docker: chown /srv/docker: invalid argument
dockerd-rootless.sh[797]: [rootlesskit:child ] error: command [/usr/bin/dockerd-rootless.sh] exited: exit status 1

does userns-remap needs root permissions? i don't have them for docker runnig as user docker as its rootless.
/srv/docker is owned docker:docker

Shouldn't userns-remap be always be enabled on rootless dockers without that option in daemon.json? Doe it makes sense to have that option given when runnig docker rootless?

Without nsremap-option docker starts and info says:

Client:
 Version:    24.0.7-ce
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.12.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.23.3
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 3
  Running: 2
  Paused: 0
  Stopped: 1
 Images: 4
 Server Version: 24.0.7-ce
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: false
  userxattr: true
 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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 4e1fe7492b9df85914c389d1f15a3ceedbb280ac
 runc version: v1.1.11-0-g4bccb38cc9cf
 init version: 
 Security Options:
  seccomp
   Profile: builtin
  rootless
  cgroupns
 Kernel Version: 5.14.21-150500.55.39-default
 Operating System: openSUSE Leap 15.5
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 26.89GiB
 Name: servpenta23
 ID: 907bb307-3299-4195-97ee-325a81160bdc
 Docker Root Dir: /srv/docker
 Debug Mode: false
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

But freeipa is not starting (see top).

There seems to be a solution here: #429 (comment)
with "1. Use the --cgroupns host Docker option and a cgroupv2 sub-hierarchy volume binding for the container. Here is an example command:
[ ...] --cgroupns host -v /sys/fs/cgroup/freeipa.scope:/sys/fs/cgroup:rw [ ... ]"

But i don't have /sys/fs/cgroup/freeipa.scope - i do have (with docker user is of id 1001):

~ # ls -ld /sys/fs/cgroup/*/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/dev-hugepages.mount/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/dev-mqueue.mount/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/init.scope/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/sys-fs-fuse-connections.mount/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/sys-kernel-config.mount/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/sys-kernel-debug.mount/
drwxr-xr-x  2 root root 0 Jan 13 15:16 /sys/fs/cgroup/sys-kernel-tracing.mount/
drwxr-xr-x 45 root root 0 Jan 19 12:01 /sys/fs/cgroup/system.slice/
drwxr-xr-x  4 root root 0 Jan 13 16:19 /sys/fs/cgroup/user.slice/

tried some of the directories, but don't get it working... e.g.
- /sys/fs/cgroup/user.slice/user-1001.slice:/sys/fs/cgroup:rw
- /sys/fs/cgroup/user.slice/user-1001.slice/user@1001.service:/sys/fs/cgroup:rw
- /sys/fs/cgroup:/sys/fs/cgroup:rw
...

Can anybody help me with that?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions