基于docker gitlab/gitlab-runner

一、安装gitlab(尽量使用80端口)

docker pull gitlab/gitlab-ce:latest

docker run  -itd -e TZ="Asia/Shanghai" -p 8083:80 -p 8082:443 -p 8084:22 -v /opt/gitlab/config:/etc/gitlab -v /opt/gitlab/logs:/var/log/gitlab -v /opt/gitlab/data:/var/docker/gitlab --name=gitlab --privileged=true  gitlab/gitlab-ce:latest

帐号注册

docker exec -it gitlab /bin/bash

gitlab-rails console

u=User.where(id:1).first
u.password='12345678'
u.password_confirmation='12345678'
u.save

参考

二、安装gitlab-runenr

docker pull gitlab/gitlab-runner:alpine

docker run  -itd -e TZ="Asia/Shanghai" --name gitlab-runner --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /opt/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:alpine
# 注册runner 信息token
http://gitip:port/admin/runners


docker exec -it gitlab-runner gitlab-runner register

其它

非80端口需要做的事情(不建议)

/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

gitlab clone路径 容器名字修改

vi /opt/gitlab/config/gitlab.rb

这里不能带有端口(上面的建议使用80,带了端口启动,无法访问)
external_url 'http://gitip'

runner无docker环境

配置参考

增加docker映射

sudo vi /opt/gitlab-runner/config/config.toml
volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"

你可能感兴趣的:(devops,docker)