标签:span conf isa dock ruby restart code git cti
新建文件docker-compose.yml,输入如下内容:
gitlab: image: ‘gitlab/gitlab-ce:latest‘ container_name: ‘gitlab‘ restart: always hostname: ‘gitlab.cjx.com‘ environment: GITLAB_OMNIBUS_CONFIG: | external_url ‘http://gitlab.cjx.com‘ # Add any other gitlab.rb configuration here, each on its own line ports: - ‘80:80‘ - ‘443:443‘ - ‘60000:22‘ volumes: - ‘/srv/gitlab/config:/etc/gitlab‘ - ‘/srv/gitlab/logs:/var/log/gitlab‘ - ‘/srv/gitlab/data:/var/opt/gitlab‘ runner: image: ‘gitlab/gitlab-runner:latest‘ container_name: ‘gitlab-runner‘ restart: always links: - gitlab:gitlab.cjx.com volumes: - ‘/srv/gitlab-runner/config:/etc/gitlab-runner‘ - ‘/var/run/docker.sock:/var/run/docker.sock‘
docker-compose up -d
参照:http://www.cnblogs.com/windchen/p/6247137.html#configrunner
虽然在gitlab-runner这个容器里面,有link到gitlab,但是build如果是选择的docker,执行时会再启动一个子容器,子容器无法识别自定义host:gitlab.cjx.com,会报 port 80 : connection refused错误,解决办法是在runnner的配置文件添加links参数
sudo vi /srv/gitlab-runner/config/config.toml
在[runners.docker]节点下面,添加红色字部分
executor = "docker" [runners.docker] links = ["gitlab:gitlab.cjx.com"] tls_verify = false image = "ruby:2.1" privileged = false disable_cache = false volumes = ["/cache"]
添加好之后,重启runner,就可以正常访问到gitlab获取code了。
docker exec -it gitlab-runner gitlab-runner restart
利用docker compose启动gitlab及runner
标签:span conf isa dock ruby restart code git cti
原文地址:http://www.cnblogs.com/windchen/p/6250311.html