Skip to content

Not sufficient rights in gitlabs base runner Docker Image

I'm using the default runner image from docker

Was using the following command:

docker run -d --name gitlab-runner --restart always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /srv/gitlab-runner/config:/etc/gitlab-runner \
  gitlab/gitlab-runner:latest

When running commands via gitlab ci / .gitlab-ci.yml which needs root permissions like apt-get I get the following error:

$ apt-get install -qy curl php5-cli
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Running those commands via docker exec do work without a problem.

I put privileged = true into /srv/gitlab-runner/config/config.toml but it didn't had any effects. So probably the user gitlab-runner has not sufficient rigts.

I wonder if this is intended behavior and what's the (security) reason for it.