I was trying to launch docker in rootless mode on Ubuntu running on EC2 instance in AWS.
When running a hello-world image, I’m getting an error from daemon: open /sys/fs/cgroup/user.slice/user-1000.slice/cgroup.controllers: no such file or directory.
Steps to reproduce
(following this guide Rootless mode | Docker Docs)
- Execute prerequisites:
apt-get install -y uidmap
apt-get install -y dbus-user-session
sudo apt-get install -y systemd-container
apt-get install docker-ce-rootless-extras
- Install:
root:
sudo systemctl disable --now docker.service docker.socket
sudo rm /var/run/docker.sock
ubuntu:
dockerd-rootless-setuptool.sh install
export XDG_RUNTIME_DIR=/home/ubuntu/.docker/run
export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///home/ubuntu/.docker/run/docker.sock
dockerd-rootless.sh &
- Run:
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
docker run hello-world
Error:
ubuntu@ip-10-6-3-22:~$ docker --debug run hello-world
time="2024-11-22T10:54:15Z" level=debug msg="[hijack] End of stdout"
ERRO[2024-11-22T10:54:15.320536634Z] Handler for POST /v1.47/containers/c2e5475a8c53623a91667d2394b244da75e623efd8297ea7ec5840b4bcfe9fa1/start returned error: open /sys/fs/cgroup/user.slice/user-1000.slice/cgroup.controllers: no such file or directory spanID=495aef4e7deb88a0 traceID=999511bfe5b030014b4c0c94c274aa89
docker: Error response from daemon: open /sys/fs/cgroup/user.slice/user-1000.slice/cgroup.controllers: no such file or directory.
Expected:
–docker run hello-world
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:305243c734571da2d100c8c8b3c3167a098cab6049c9a5b066b6021a60fcb966
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.