Skip to content

Encountered error [rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: operation not permitted when build the docker image #425

Open
@ponkio-o

Description

@ponkio-o

Hi, I'm using rootless docker for use Docker in Docker (DinD). I need a hand with an error like the titile.

What happened?

We are using the following Dockerfile (and entrypoint), but the build has not been going through in the last week or so.
(In other words, the build was working correctly until last week)

FROM ubuntu:22.04

RUN apt-get update && apt-get install -y --no-install-recommends \
  kmod \
  dbus-user-session \
  curl \
  ca-certificates \
  uidmap \
  openssl \
  gnupg \
  gpg \
  iproute2 \
  && rm -rf /var/lib/apt/lists/* \
  && rm -rf /tmp/*

RUN install -m 0755 -d /etc/apt/keyrings; \
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg; \
    chmod a+r /etc/apt/keyrings/docker.gpg; \
    echo \
      "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
     tee /etc/apt/sources.list.d/docker.list > /dev/null
RUN apt-get update && apt-get upgrade -y; \
    apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

RUN echo "kernel.unprivileged_userns_clone=1" >> /etc/sysctl.conf; \
    echo "user.max_user_namespaces=28633" >> /etc/sysctl.conf; \
    sysctl --system

RUN set -eux; \
    addgroup --system dockremap; \
    adduser --system --no-create-home --ingroup=dockremap dockremap; \
    echo 'dockremap:165536:65536' >> /etc/subuid; \
    echo 'dockremap:165536:65536' >> /etc/subgid

RUN set -eux; \
    addgroup --system docker; \
    addgroup --system --gid=1000 rootless; \
    adduser --disabled-password --uid=1000 --ingroup=rootless rootless; \
    adduser rootless docker

COPY rootless_entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

RUN mkdir -p /home/rootless/.local/share/docker
RUN chown -R rootless:rootless /home/rootless/.local/share/docker
RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client
USER rootless
RUN dockerd-rootless-setuptool.sh install --skip-iptables

CMD ["/entrypoint.sh"]

The rootless_entrypoint.sh is below.

#!/bin/bash

echo "Generating Docker TLS certificate and key..."
mkdir -p /certs
openssl genrsa -out /certs/key.pem 4096
openssl req -new -x509 -sha256 -key /certs/key.pem -out /certs/cert.pem -days 365 -subj '/CN=localhost'

echo "Starting Docker..."
dockerd-rootless.sh -H ${DOCKER_HOST} --tlsverify --tlscacert=/certs/cert.pem --tlscert=/certs/cert.pem --tlskey=/certs/key.pem

The error message is as follows:

$ ls
Dockerfile              rootless_entrypoint.sh

$ docker build -t rootless-docker .
 => ERROR [13/13] RUN dockerd-rootless-setuptool.sh install --skip-iptables                                                                    0.1s
------
 > [13/13] RUN dockerd-rootless-setuptool.sh install --skip-iptables:
0.104 [rootlesskit:parent] error: failed to start the child: fork/exec /proc/self/exe: operation not permitted
0.104 [ERROR] RootlessKit failed, see the error messages and https://rootlesscontaine.rs/getting-started/common/ .
------
Dockerfile:49
--------------------
  47 |     RUN mkdir /certs /certs/client && chmod 1777 /certs /certs/client
  48 |     USER rootless
  49 | >>> RUN dockerd-rootless-setuptool.sh install --skip-iptables
  50 |
  51 |     CMD ["/entrypoint.sh"]
--------------------
ERROR: failed to solve: process "/bin/sh -c dockerd-rootless-setuptool.sh install --skip-iptables" did not complete successfully: exit code: 1

Environment

Build machine: Mac Studio Apple M2 Ultra
OS: macOS 13.6
Docker: Docker version 25.0.3, build 4debf41

What do I do to solve this problem?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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