Gitlab-runner permissions


I have a host running several containers:

  • A Nginx reverse proxy
  • Gitlab CE
  • Gitlab-runner

I also mounted a network share by adding this line to my /etc/fstab:

//mycompany/sharedfolder /mnt/sharedfolder cifs credentials=/root/.smbcredentials,users,rw,iocharset=utf8,sec=ntlm,vers=3.0 0 0

As root, from my machine, I can read and write on this /mnt/sharedfolder

In my docker-compose.yml entry for gitlab-runner, I added this new volume (last line):

    image: gitlab/gitlab-runner:latest
    container_name: gitlab-runner
    hostname: gitlab-runner
    restart: always
      - '/srv/gitlab-runner/config:/etc/gitlab-runner'
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '/mnt/sharedfolder:/mnt/sharedfolder:rw'

But when I run a job with my runner, I don’t have the permissions to write on /mnt/sharedfolder, only to read.

$ touch /mnt/sharedfolder/test.txt
touch: cannot touch '/mnt/sharedfolder/test.txt': Permission denied

I’m now completely lost with permissions and who’s executing what… Any enlightening suggestions ?

Thanks a lot


Try this:

- '/mnt/sharedfolder:/mnt/sharedfolder:Z'

add a Z at the end