Centos7.5+Docker+Jenkins+gitlab構建可持續集成環境

1、安裝docker

1、Docker安裝

#刪除已有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

#設置倉庫
yum install -y yum-utils device-mapper-persistent-data lvm2

#使用阿里雲鏡像
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

#安裝docker
yum install docker-ce

#啓用阿里雲docker鏡像加速 獲取地址https://cr.console.aliyun.com
mkdir -p /etc/docker
vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}

#開機啓動設置
systemctl enable docker

#啓動
systemctl start docker

#測試
docker run hello-world

2、開啓Docker Remote API

#查看配置文件地址
systemctl show --property=FragmentPath docker 

#編輯配置文件內容,接收所有ip請求
vim  /lib/systemd/system/docker.service 
ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5678

#重新加載配置文件
systemctl daemon-reload 
systemctl restart docker

#查看防火牆是否開啓
systemctl status firewalld

#開啓防火牆
systemctl start firewalld

#開啓防火牆的端口
firewall-cmd --zone=public --add-port=5678/tcp --permanent 
firewall-cmd --reload
firewall-cmd --zone=public --query-port=5678/tcp

#測試
docker -H localhost:5678 version

3、安裝Jenkins

https://jenkins.io/zh/doc/book/installing/

需要單獨安裝插件:

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章