k8s之harbor私有镜像仓库部署

一、安装Docker-compose下载地址:
https://github.com/docker/compose/releases
文件下载下来是个二进制文件 , 加x权限放到/usr/bin目录下
[root@node4 harbor]# lsdocker-compose-linux-x86_64harborharbor-offline-installer-v2.3.1.tgz[root@node4 harbor]# cp docker-compose-Linux-x86_64 /usr/bin/docker-compose[root@node4 harbor]# chmod +x /usr/bin/docker-compose二、安装harbor下载地址:
https://github.com/goharbor/harbor/releases
解压安装包 , 修改harbor.yml.tmpl文件并重命名成harbor.yml , 这是harbor的配置文件 , 执行安装之前要改好 , 我这里只改了主机名和禁用了https
[root@node4 harbor]# lscommondocker-compose.ymlharbor.ymlinstall.shpreparecommon.shharbor.v2.3.1.tar.gzharbor.yml.tmpl.bakLICENSE[root@node4 harbor]# cat harbor.yml |grep hostname# The IP address or hostname to access admin UI and registry service.hostname: node4在执行./install安装之前 , 确保docker处于运行状态 。install完成后 , 默认使用80端口即访问 。

k8s之harbor私有镜像仓库部署

文章插图
 
三、harbor启动与停止启动 , 启动时要进入harbor的安装目录
docker-compose up -d【k8s之harbor私有镜像仓库部署】停止
docker-compose stop四、docker登录harborhttp方式 , 需要修改/etc/dcoker/daemon.json
{"insecure-registries": ["node4"]}登录
[root@node4 ~]# docker login192.168.21.34Authenticating with existing credentials...Stored credentials invalid or expiredUsername (admin): Password: WARNING! Your password will be stored unencrypted in /root/.docker/config.json.Configure a credential helper to remove this warning. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded五、上传镜像到仓库先pull一个Nginx:1.15到本地 , 打tag , 上传
[root@node4 ~]# docker pull nginx:1.151.15: Pulling from library/nginx743f2d6c1f65: Pull complete 6bfc4ec4420a: Pull complete 688a776db95f: Pull complete Digest: sha256:23b4dcdf0d34d4a129755fc6f52e1c6e23bb34ea011b315d87e193033bcd1b68Status: Downloaded newer image for nginx:1.15docker.io/library/nginx:1.15[root@node4 ~]# docker tag nginx:1.15 192.168.21.34/release/nginx:v1.15[root@node4 ~]# docker push 192.168.21.34/release/nginx:v1.15 The push refers to repository [192.168.21.34/release/nginx]332fa54c5886: Pushed 6ba094226eea: Pushed 6270adb5794c: Pushed v1.15: digest: sha256:e770165fef9e36b990882a4083d8ccf5e29e469a8609bb6b2e3b47d9510e2c8d size: 948




    推荐阅读