1、搭建本地仓库
仓库端


关闭selinux


修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启




安装docker
yum -y install docker




设置开机自启动并开启服务
[root@k8s-master ~]# chkconfig docker on
[root@k8s-master ~]# service docker start






启动docker后台服务
service docker start




运行registry容器
docker run -itd -v /data/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest 




客户端


[root@node ~]# vim /etc/docker/daemon.json 
{
  "registry-mirrors": [ "https://registry.docker-cn.com"],
  "insecure-registries": [ "172.18.18.90:5000"]
}


添加私有镜像服务器的地址,注意书写格式为json,有严格的书写要求,然后重启docker服务:


[root@node ~]# systemctl  restart docker




打标签上传
docker tag python_re 172.16.0.56:5000/python_re






列出所有镜像:


[root@node ~]# curl  http://172.18.18.90:5000/v2/_catalog
{"repositories":["busybox"]}


2、安装配置jenkins和gitlab
安装jenkins
安装jdk
[root@jenkins ~]# yum install java-1.8.0-openjdk




sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key


yum install jenkins




systemctl start jenkins

systemctl enable jenkins


感谢!!!

https://blog.csdn.net/ruangong1203/article/details/73065410

遇到无法链接gitlab
原因:jenkins是用户jenkins起的,所以密钥生成应该在jenkins用户底下生成
解决办法:
vi /etc/passwd
将jenkins仿照root修改,在jenkins用户下生成ssh


Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐