- Get runner image -
docker pull gitlab/gitlab-runner:latest
- Clone & change into source code dierctory (ensure .gitlab-ci.yml exists and is valid) -
cd <REPO>
- Start a container called gitlab-runner0 -
docker run -d \--name gitlab-runner0 \
--restart always \
-v $PWD:$PWD \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
- Add directory exception (should run in project root) -
docker exec -it -w $PWD gitlab-runner0 git config --global --add safe.directory $PWD
- Suppose job name is build-p2-master, then run job with -
docker exec -it -w $PWD gitlab-runner0 gitlab-runner exec docker build-p2-master