Skip to content

Instantly share code, notes, and snippets.

@NikiforovAll
Created June 10, 2021 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NikiforovAll/7294ce1a72bdcfbf4159896853589b9f to your computer and use it in GitHub Desktop.
Save NikiforovAll/7294ce1a72bdcfbf4159896853589b9f to your computer and use it in GitHub Desktop.
GitLab Runner + Docker

GitLab Runner

See: https://docs.gitlab.com/runner/install/docker.html.

Build image:

docker run -d \
  --name gitlab-runner \
  --restart always \
  -v $PWD:$PWD \
  -v /var/run/docker.sock:/var/run/docker.sock \
  gitlab/gitlab-runner:latest

Run job: docker exec -it -w $PWD gitlab-runner gitlab-runner exec docker <jobName>

docker exec -it -w $PWD gitlab-runner gitlab-runner exec docker
--env "KEY=VALUE"

NOTE: job is run in context of current latest commit, i.e. HEAD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment