Installing Gitlab Runner
Docker Pull Gitlab/gitlab-runner
Start Gitlab Runner
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
Configuring Gitlab Runner
Docker exec-it Gitlab-runner Gitlab-runner Register
Enter the Gitlab CI address, for example: Http://gitlab.com/ci
Input token: Can be found in Gitlab admin area->overview->runners
Enter description information
Enter tag
INPUT type: Docker
Input Image: Ruby2.1
Configuring the CI Script
On the Gitlab Project home page, there are options: Setup CI, which will create a. gitlab-ci.yml file after clicking,
Simple input test script:
image:registry.cn-hangzhou.aliyuncs.com/cjx/tutorialbuild: stage:build script: - dotnet Restore -dotnet Run
When finished, runner will automatically run the script.
The pits encountered:
In the beginning, there is a custom Gitlab hosts:gitlab.cjx.com, when the test script is run with runner, even if the host is added when the runner is started, the port 80:connection refused error is reported. Seemingly container inside of the runner at all did not parse this hosts file, finally the hosts removed all with IP access done.
Docker run --name gitlab-runner--restart always--add-host gitlab.cjx.com:192.168. 30.129 -v/var/run/docker.sock:/var/run/docker.sock -v/srv/gitlab-runner/config:/etc /gitlab-runner Gitlab/gitlab-runner:latest
The specific reasons need to be studied again.
Setup CI on the Gitlab