Getting `No user exists for uid ****` error when running some commands


Probably a really basic question but I’m struggling with one job in my gitlab ci pipeline, basically I have a stage which uses a node image as base (with some extra added apt packages) which I run some visual regression tests on. All works great however if I am to use a command such as rsync or scp I get the error No user exists for uid ***

I’m guessing this is something todo with the gitlab runner accessing running commands within the docker node image and not having the correct permissions.

I’ve tried the following

  • Setting the user within the entrypoint of the job
  • Setting the USER within the custom node image I’m using
  • Using an alpine docker image and running rsync from that

Any pointers or documentation on how I can fix the error / or why it’s happening would be great.

  • Using a self hosted version of Gitlab (GitLab Community Edition 15.8.0)

Job in question (from .gitlab-ci.yml) is similar to below (trimmed it down a little)

"Visual Regression tests":
  stage: "Test Sandbox"
  image: ourcustom/node-image:latest
      when: always
    - when: never
      - node_modules/
    - uname -a
    - cd tests
    - npm run vr-tests  || exit_code=$?

    - rsync -avC test/output user@hostname:/tests/$CI_PIPELINE_IID/result

    - exit $exit_code
  allow_failure: true

It means that the rsync is trying to replicate ownership of the objects (the -a flag) which means setting it to the user in the container and since such user does not exist on target machine you get the error.

Quick fix is to remove the -a from rsync command and replace it with ones you need without ownership replication.