Gitlab-runner (executor docker) problem in non root image

Have docker-image with non root user
But in job, repo checkouted with root rights. (why? helpers?)

any ideas how make checkout with my user?

dockerfile mock
FROM ubuntu:xenial 

# does not matter

RUN groupadd mygroup \
 && useradd -d /home/myuser -s /bin/bash -m -g mygroup myuser \
 && mkdir -p /builds \
 && mkdir -p /cache \
 && chown myuser:mygroup /builds \
 && chown myuser:mygroup /cache

USER myuser
WORKDIR /home/myuser
concurrent = 10
check_interval = 0

  session_timeout = 1800

  name = "docker-runners"
  limit = 0
  output_limit = 4096
  url = "{server here}"
  token = "{token here}"
  executor = "docker"
    tls_verify = false
  image = "{base image here}"
  privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = true
    disable_cache = false
  volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    shm_size = 0
  environment = []
  image: {non root image here}
    - ls -al
    - whoami

I think what you’re looking for is

1 Like

Thank you for link!.
Exactly same question. Found some tricks in answers.

But did you actually find a solution? I only see two very hacky workarounds, and a suggestion that the better one won’t work for your use-case. What have you done, in the end?