Docker安装Gitlab和Gitlab-Runner并实现项目CICD

参考:

https://segmentfault.com/a/1190000020593208

https://www.cnblogs.com/zzhaolei/p/11063345.html

https://docs.gitlab.com/runner/configuration/advanced-configuration.html

https://docs.gitlab.com/runner/register/#docker

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

可以参考下面的:

1、运行gitlab-runner

sudo docker run -d --name gitlab-runner --restart always             -p 8093:8093             -v /var/run/docker.sock:/var/run/docker.sock             -v /volume1/homes/pengdonglin137/gitlab-runner-config:/etc/gitlab-runner             gitlab/gitlab-runner:latest

2、注册

sudo docker exec -it gitlab-runner gitlab-runner register

3、重启

sudo docker exec -it gitlab-runner gitlab-runner restart

config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "docker_runner"
  url = "http://192.168.1.102:30000/"
  token = "oMjNxBsuCqgxEBUmXRZj"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
  [runners.docker]
    tls_verify = false
    image = "ubuntu:16.04"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache","/var/run/docker.sock:/var/run/docker.sock","/volume1/homes/pengdonglin137/opt:/opt:rw"]
    pull_policy = "if-not-present"
    shm_size = 0

完。

相关推荐