继私有仓库registey后部署的第二个私有仓库harbor。
私有仓库registry的部署过程:
https://blog.csdn.net/qq_42527269/article/details/106007151
——————————————————————————————
实验环境:
系统版本:centos7.4.1708
Docker版本:19.03.8
实验主机:
docker01:192.168.1.3
docker02:192.168.1.4(作为仓库)
准备软件包harbor-offine-installer-v1.1.1.tgz放置目录/opt下:
[root@docker02 opt]# ls containerd harbor-offline-installer-v1.1.1.tgz myregistry registry-var
对软件包进行解压后进入释放出来的目录内:
[root@docker02 opt]# tar xf harbor-offline-installer-v1.1.1.tgz [root@docker02 opt]# cd harbor/
修改harbor的配置文件:
[root@docker02 harbor]# vim harbor.cfg hostname = 192.168.1.4 #第五行,修改为自己的地址 harbor_admin_password = 123123 #第五十五行,设置admin密码
安装docker-compose:
[root@docker02 harbor]# yum -y install docker-compose [root@docker02 harbor]# docker-compose -v docker-compose version 1.18.0, build 8dd22a9
利用harbor自带的安装脚本进行安装:
[root@docker02 harbor]# ./install.sh ...... ✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://192.168.1.4. For more details, please visit https://github.com/vmware/harbor .
使用:(docker01配置)
修改配置文件:
[root@docker01 ~]# cat /etc/docker/daemon.json { "registry-mirrors":["https://655dds7u.mirror.aliyuncs.com"], "insecure-registries":["192.168.1.4"] } [root@docker01 ~]# systemctl restart docker
登陆仓库:
[root@docker01 ~]# docker login 192.168.1.4 Username: admin Password: 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
尝试上传镜像:上传需要权限,下载不用
[root@docker01 ~]# docker tag nginx:latest 192.168.1.4/library/nginx:latest [root@docker01 ~]# docker push 192.168.1.4/library/nginx:latest The push refers to repository [192.168.1.4/library/nginx] b3003aac411c: Pushed 216cf33c0a28: Pushed c2adabaecedb: Pushed latest: digest: sha256:cccef6d6bdea671c394956e24b0d0c44cd82dbe83f543a47fdc790fadea48422 size: 948
清空镜像,尝试下载:
[root@docker01 ~]# docker rmi -f `docker images -q` [root@docker01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE [root@docker01 ~]# docker pull 192.168.1.4/library/nginx:latest latest: Pulling from library/nginx 54fec2fa59d0: Pull complete 4ede6f09aefe: Pull complete f9dc69acb465: Pull complete Digest: sha256:cccef6d6bdea671c394956e24b0d0c44cd82dbe83f543a47fdc790fadea48422 Status: Downloaded newer image for 192.168.1.4/library/nginx:latest 192.168.1.4/library/nginx:latest [root@docker01 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.1.4/library/nginx latest 602e111c06b6 2 weeks ago 127MB
上传和下载都正常。
此实验到此结束。