其他分享
首页 > 其他分享> > Albert.Huang1_How to install your own gitlab runner for CICD

Albert.Huang1_How to install your own gitlab runner for CICD

作者:互联网

 Pull image

docker pull gitlab/gitlab-runner

 Run container

docker run -d \
--name albert_gitlab_runner \
-v /home/servdesk/albert_huang1/docker_mounts/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest

Register

docker exec -it albert_gitlab_runner gitlab-runner register \
--non-interactive \
--url "http://10.67.0.251:5678" \
--registration-token "rJ-ayJniFu5SBXYTAit_" \
--executor "docker" \
--docker-image docker:latest \
--description "albert_gitlab_runner" \
--tag-list "10.67.0.251" \
--docker-privileged=true \
--docker-pull-policy="if-not-present" \
--run-untagged \
--locked="false"

For registration-token, we use shared runner

 

Config

Add "/var/run/docker.sock:/var/run/docker.sock" to volumes for transparency between docker container and host machine

PROD [root@wqdcitcee001 config]# cat config.toml
concurrent = 1
check_interval = 0
 
[session_server]
  session_timeout = 1800
 
[[runners]]
  name = "albert_gitlab_runner"
  url = "http://10.67.0.251:5678"
  token = "Zg4oSpRigs-aR6bXWZXm"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    pull_policy = ["if-not-present"]
    shm_size = 0
PROD [root@wqdcitcee001 config]#

Restart container

docker restart albert_gitlab_runner

 

标签:own,run,runner,CICD,gitlab,--,docker,runners
来源: https://www.cnblogs.com/hmlhml/p/15798534.html