搭建harbor私有仓库

 

 

 

 

 

#安装docker
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
yum makecache fast yum -y install docker-ce
systemctl start docker
#安装docker-compose先检查linux有没有安装python-pip包
[root@ localhost harbor]# pip -V
bash: pip: 未找到命令...
#没有安装
[root@ localhost harbor]# yum -y install epel-release
[root@ localhost harbor]# yum -y install python-pip
#对安装好的pip进行升级
[root@ localhost harbor]# pip install --upgrade pip
[root@ localhost harbor]# pip install docker-compose --ignore-installed requests 
#检查docker-compose 安装
[root@ localhost harbor]# docker-compose -version
docker-compose version 1.23.2, build 1110ad0

 

#我的harbor版本:harbor-offline-installer-v1.8.1.tgz 直接解压后
[root@ localhost harbor]# ls
common  docker-compose.yml  harbor.v1.8.1.tar.gz  harbor.yml  install.sh  LICENSE  prepare

!! 每次修改完配置文件以后要记得关闭harbor重载以后再重启harbor生效 ./prepare


#这里我只修改了本地ip 和用户名密码 但是后面不知道为什么使用这个账号密码登不进去 但是可以正常创建用户使用

 


 

#安装harbor 过程较长 
[root@localhost harbor]#sh install.sh

#harbor的启动停止都要依赖dockers compose
[root@localhost harbor]#docker-compose start
 

 


 


 

#然后使用docker拉了个BUSYBOX测试
[root@ localhost harbor]# docker pull busybox:latest

#不加这个没法用 记得换上自己IP
[root@ localhost harbor]# cat /etc/docker/daemon.json
{ "insecure-registries":["10.0.0.43"]}

#然后登陆过去  我这已经成功了 输入的账号密码就是harbor配置文件里的账号密码
[root@ localhost harbor]# docker login 10.0.0.43
Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded


#把刚才的busybox打个tag 传到harbor仓库中   library是harbor初始就有的空项目  我已经在页面中创建了一个aaa的项目
[root@ localhost harbor]# docker tag busybox:latest 10.0.0.43/aaa/busybox

#然后直接push上传镜像
[root@ localhost harbor]# docker push 10.0.0.43/aaa/busybox
The push refers to repository [10.0.0.43/aaa/busybox]
d2421964bad1: Pushed
latest: digest: sha256:c9249fdf56138f0d929e2080ae98ee9cb2946f71498fc1484288e6a935b5e5bc size: 527

 

 

posted @ 2020-10-16 18:24  SanPIng  阅读(463)  评论(0编辑  收藏  举报