Docker部署gitlab-ce & gitlab-runner

一.机器准备工作(Centos7)

1.安装docker

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

sudo yum install -y yum-utils device-mapper-persistent-data lvm2

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

sudo yum makecache fast

sudo yum -y install docker-ce


sudo systemctl start docker
sudo systemctl enable docker

2.修改本机sshd的默认端口

  注意:关闭防火墙和selinux,不然会影响端口的修改

vim /etc/ssh/sshd_config

 Docker部署gitlab-ce & gitlab-runner_第1张图片

systemctl restart sshd

二.容器化部署

1.docker上运行gitlab-ce

sudo docker run --detach \
  --hostname 192.168.70.134 \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume /srv/gitlab/config:/etc/gitlab \
  --volume /srv/gitlab/logs:/var/log/gitlab \
  --volume /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest

   运行起来后,请参照上一篇博客说明https://blog.csdn.net/chinoukin/article/details/90259634

2.docker上运行gitlab-runner

docker run -d --name gitlab-runner --restart always \
   -v /srv/gitlab-runner/config:/etc/gitlab-runner \
   -v /var/run/docker.sock:/var/run/docker.sock \
   gitlab/gitlab-runner:latest

3.注册gitlab-runner

docker exec -it gitlab-runner gitlab-runner register


# 根据提示注册runner,注册所需的信息请在gitlab上获取(用管理员用户登录gitlab)

 

 

你可能感兴趣的:(Linux,docker,服务器)