https://about.gitlab.com/install/?version=ce#debian
- Install dependencies
sudo apt-get install -y curl openssh-server ca-certificates perl (sudo apt-get install -y postfix)
- Add official gitlab repository and install gitlab community edition
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ce
- Ready - Login to the webinterface
- Install dependencies
sudo apt-get install -y curl openssh-server ca-certificates perl (sudo apt-get install -y postfix)
- Add official gitlab repository and install gitlab community edition
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt-get install gitlab-runner
- Install docker accoring to my
docker-installation.md
tutorial - Register runner to gitlab
sudo gitlab-runner register
- Use URL and Token from gitlab Admin-Area / Overview / Runners
- Description:
gitlab-runner1
- Tags:
tag1
,tag2
(Don't really know what tags are doing. Probably the runner gets limited to run only when specific project tags are present.) - Executor:
docker
- Docker default image:
debian:buster
- Allow runner to run without tags present
- In Admin-Area / Overview / Runners set checkbox "Indicates whether this runner can pick jobs without tags".
- Enable an 'if-not-present' pull policy to only download containers from Docker Hub, when not present on localhost by:
sudo nano /etc/gitlab-runner/config.toml [runners.docker] pull_policy = "if-not-present
The Gitlab Container Registry enables to store custom built containers on the gitlab instance and use them in CI/CD jobs.
- Ensure gitlab is accessible on HTTPS
The custom certificate hast to be placed at:
/etc/gitlab/ssl/gitlab.example.com.crt
/etc/gitlab/ssl/gitlab.example.com.key
- Enable container registry
sudo nano /etc/gitlab/gitlab.rb registry_external_url 'https://gitlab.example.com:5050' gitlab-ctl reconfigure
- You should see the Container-Registry in Project / Package & Repositories.
- Enable gitlab container registry garbage collection: https://docs.gitlab.com/ee/administration/packages/container_registry.html#running-the-garbage-collection-on-schedule
- To enable docker access to self-signed certificate registry, place the gitlab public certificate
server.crt
on the gitlab runner to/etc/docker/certs.d/gitlab.example.com:5050/ca.crt
- Create a deploy token with at least
read_registry
andwrite_registy
permissions in the project. - Login with docker by:
docker login gitlab.example.com:5050 -u token-name-1 -p <Deploy-Token>
- To build docker images by CI/CD, please read: https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding
- Docker socket binding on the gitlab runner host by adding:
sudo nano /etc/gitlab-runner/config.toml [runners.cache] Insecure = false [runners.docker] image = "docker:latest" privileged = false volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]