Linux安装docker和gitlab-runner

install docker-ce

1
2
3
4
5
6
7
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate  docker-logrotate docker-engine -y

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

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum install docker-ce docker-ce-cli containerd.io -y

增加腾讯云加速器

1
2
3
4
5
6
cat /etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
]
}
启动docker服务

systemctl start docker

拉起一个容器,测试验证docker

docker run hello-world

install gitlab-runner

1
2
3
4
wget https://mirrors.cloud.tencent.com/gitlab-runner/yum/el7/gitlab-runner-12.7.1-1.x86_64.rpm

yum install -y gitlab-runner-12.7.1-1.x86_64.rpm

补充:如果是二进制安装gitlan-runner,这需要以下添加:

1
2
3
4
5
6
7
8
9
### creat gitlab-runner user and set docker user-power
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
groupadd docker
gpasswd -a gitlab-runner docker
newgrp docker
su gitlab-runner
docker ps
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
gitlab-runner start
gitlab-runner向gitlab注册,并install和start gitlab-runner
1
2
3
4
5
gitlab-runner register

gitlab-runner install

gitlab-runner start
git push code and check gitlab-cicd jobs

Linux安装docker和gitlab-runner
https://randzz.cn/ed89efedbfd4/linux安装docker和gitlab-runner/
作者
Ezreal Rao
发布于
2020年5月15日
许可协议