Before your getting started, you can read the official documentation and don't read this article 😉
So, if you're still here, let's do it together!💪
Pull the GitLab Runner Docker Image: Open your terminal and run the following command to pull the GitLab Runner Docker image:
docker pull gitlab/gitlab-runner:latest
Run the GitLab Runner Container:
Next, run the GitLab Runner container. You can use the following command to start it in detached mode:
docker run -d --name yuit-gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
This command does the following:
- Runs the container in detached mode (-d).
- Names the container
yuit-gitlab-runner
. - Restarts the runner automatically if it stops.
- Maps the configuration directory (/srv/gitlab-runner/config) on your host to the runner configuration directory in the container (/etc/gitlab-runner).
- Select CI/CD > Runners.
- Select New instance runner.
- In the Tags section, in the Tags field, enter the job tags to specify jobs the runner can run. If there are no job tags for this runner, select Run untagged:
yuit-runner-tag
- Runner description:
Runner of docker container
- Select the operating system where GitLab Runner is installed:
linux
Registering runners in local docker container
docker exec -it yuit-gitlab-runner gitlab-runner register
Enter the GitLab instance URL: https://gitlab.com
Enter the registration token: ****
Enter a name for the runner: yuit-runner
Enter an executor: docker
Enter the default Docker image: node:20.16-alpine
Top comments (0)