Skip to content

User ID conflict / permission issues with GitLab Runner in v5 #408

@mbrodala

Description

@mbrodala

Given a Docker image build using the v5 of this image is triggered by a GitLab shell runner one will get permission issues.

E.g. with a basic STARTUP_COMMAND_DONE=touch ~/.startup_done (see #200 (comment)) the result is:

touch: cannot touch '/home/docker/.startup_done': Permission denied

The reason is that the related project was cloned by the gitlab-runner user on the host system which has the ID 998. Normally the entrypoint of this image would adjust the ID of the docker user accordingly. But unfortunately the ID 998 is already in use with the v5 images based on Ubuntu 24.04 where this is the systemd-network user. So there is an ID conflict here which causes permission issues.

This is not an issue with the v4 images based on Ubuntu 20.04.


Once more for clarity:

$ id
uid=998(gitlab-runner) gid=997(gitlab-runner) groups=997(gitlab-runner),998(docker)
$ docker run --rm -it --volume .:/usr/src/app thecodingmachine/php:8.2-v5-cli bash
systemd-network@8a425975c581:/usr/src/app$ id
uid=998(systemd-network) gid=998(systemd-network) groups=998(systemd-network)
systemd-network@8a425975c581:/usr/src/app$ pwd
/usr/src/app
systemd-network@8a425975c581:/usr/src/app$ ls -ld .
drwxr-xr-x 8 systemd-network polkitd 4096 Feb  6 12:04 .
systemd-network@8a425975c581:/usr/src/app$ ls -ld /home/docker
drwxr-x--- 1 docker docker 4096 Feb  1 04:33 /home/docker

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