1. 登录harbor管理页面,创建项目,比如yuqx_test

2. admin登录,此处免密登录,正常情况下会输入账号密码

[root@k8s-rancher2 ~]# docker login 1.1.1.1:2021
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
[root@k8s-rancher2 ~]#

3. 查看本地镜像列表

[root@k8s-rancher2 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
1.1.1.1:2021/yuqx/php-fpm 7.4.20 c7588980b561 9 days ago 937MB
redis 6.2.5 ddcca4b8a6f0 2 weeks ago 105MB
nginx latest dd34e67e3371 2 weeks ago 133MB
mariadb 10.6.4 45eaeedf03de 3 weeks ago 409MB
php fpm-alpine 1daa2d1ff198 3 weeks ago 83.8MB

4. 给镜像打tag

[root@k8s-rancher2 ~]# docker tag redis:6.2.5 1.1.1.1:2021/yuqx_test/redis:6.2.5
[root@k8s-rancher2 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
1.1.1.1:2021/yuqx/php-fpm 7.4.20 c7588980b561 9 days ago 937MB
1.1.1.1:2021/yuqx_test/redis 6.2.5 ddcca4b8a6f0 2 weeks ago 105MB
redis 6.2.5 ddcca4b8a6f0 2 weeks ago 105MB
nginx latest dd34e67e3371 2 weeks ago 133MB
mariadb 10.6.4 45eaeedf03de 3 weeks ago 409MB
php fpm-alpine 1daa2d1ff198 3 weeks ago 83.8MB
rancher/rancher-agent v2.5.9 ebd5d4b8d7aa 6 weeks ago 536MB

5. push到远程仓库

[root@k8s-rancher2 ~]# docker push 1.1.1.1:2021/yuqx_test/redis:6.2.5
The push refers to repository [1.1.1.1:2021/yuqx_test/redis]
0083597d42d1: Pushed
992463b68327: Pushed
4be6d4460d36: Pushed
ec92e47b7c52: Pushed
b6fc243eaea7: Pushed
f68ef921efae: Pushed
6.2.5: digest: sha256:eda375fa1d5b3c1b9c81a591bd4bc9934a2f45b346d36ef1aeafcf36212835d2 size: 1574
[root@k8s-rancher2 ~]#

6. 上传成功后,打开harbor管理页即可看见刚刚上传的redis镜像。(可在成员里添加项目的用户)

7.  退出登录

[root@k8s-rancher2 ~]# docker logout 1.1.1.1:2021
Removing login credentials for 1.1.1.1:2021
[root@k8s-rancher2 ~]#

8. pull远程仓库镜像

[root@k8s-rancher3 ~]# docker login 1.1.1.1:2021
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
[root@k8s-rancher3 ~]# docker pull 1.1.1.1:2021/yuqx_test/redis:6.2.5
6.2.5: Pulling from yuqx_test/redis
e1acddbe380c: Pull complete
a31098369fcc: Pull complete
4a49b0eba86d: Pull complete
fddf1399efac: Pull complete
5c6658b59b72: Pull complete
0b88638a5b77: Pull complete
Digest: sha256:eda375fa1d5b3c1b9c81a591bd4bc9934a2f45b346d36ef1aeafcf36212835d2
Status: Downloaded newer image for 1.1.1.1:2021/yuqx_test/redis:6.2.5
1.1.1.1:2021/yuqx_test/redis:6.2.5
[root@k8s-rancher3 ~]#

[root@k8s-rancher3 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
1.1.1.1:2021/yuqx_test/redis 6.2.5 ddcca4b8a6f0 2 weeks ago 105MB
apache/flink 1.13.2-scala_2.11 6046a5b9482c 3 weeks ago 632MB
[root@k8s-rancher3 ~]# docker logout 1.1.1.1:2021
Removing login credentials for 1.1.1.1:2021
[root@k8s-rancher3 ~]#

完毕。

常见问题:docker login

[root@web-dev1 yuqx]# docker login 1.1.1.1:2021
Username: admin
Password:
Error response from daemon: Get "https://1.1.1.1:2021/v2/": http: server gave HTTP response to HTTPS client

解决:daemon.json 加入insecure-registries配置,然后重启docker

[root@web-dev1 yuqx]# vim /etc/docker/daemon.json
  1 {
2 "registry-mirrors": ["https://dockerhub.azk8s.cn","https://hub-mirror.c.163.com"],
3 "exec-opts": ["native.cgroupdriver=cgroupfs"],
4 "log-driver": "json-file",
5 "log-opts": {"max-size": "10m","max-file": "10"},
6 "insecure-registries":["1.1.1.1:2021"]
7 }
[root@web-dev1 yuqx]# systemctl restart docker
[root@web-dev1 yuqx]# docker login 1.1.1.1:2021
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

docker-harbor私有仓库使用笔记的更多相关文章

  1. Docker Harbor私有仓库部署与管理 (超详细配图)

    Docker Harbor私有仓库部署与管理 1.Harbor 介绍 2.Harbor部署 3.Harbor管理 1.Harbor 介绍: 什么是 Harbor ? Harbor 是 VMware 公 ...

  2. Docker以http访问Harbor私有仓库(一)

    1 说明 前文Centos7搭建Harbor私有仓库(一)我们成功搭建Harbor,本篇我们主要配置Docker以http方式访问私有仓库 2 Docker配置 2.1 Mac系统 2.1.1 配置D ...

  3. Docker以https访问Harbor私有仓库(二)

    1 说明 前文Centos7搭建Harbor私有仓库(二)中,我们以https方式搭建了Harbor,本篇我们主要配置Docker以https方式访问Harbor私有仓库 2 Docker配置 2.1 ...

  4. 在jenkins中使用shell命令推送当前主机上的docker镜像到远程的Harbor私有仓库

    1.jenkins主机上的docker配置 先在Jenkins主机的docke上配置上Harbor私有仓库地址 cat /etc/docker/daemon.json { "insecure ...

  5. 菜鸟系列docker——搭建私有仓库harbor(6)

    docker 搭建私有仓库harbor 1. 准备条件 安装docker sudo yum update sudo yum install -y yum-utils device-mapper-per ...

  6. Harbor私有仓库中如何彻底删除镜像释放存储空间?

    简介: Harbor私有仓库运行一段时间后,仓库中存有大量镜像,会占用太多的存储空间.直接通过Harbor界面删除相关镜像,并不会自动删除存储中的文件和镜像.需要停止Harbor服务,执行垃圾回收命令 ...

  7. 创建Harbor私有仓库

    前提 1.安装docker服务 参考:https://blog.csdn.net/weixin_36522099/article/details/108861134 老名字:docker.docker ...

  8. 配置 Containerd 在 harbor 私有仓库拉取镜像

    官方文档地址:https://github.com/containerd/cri/blob/master/docs/registry.md 严格来说,这个具体可分为两部分 1.在k8s中使用Conta ...

  9. 搭建harbor私有仓库

    2-1.项目说明  Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,由VMware开源,其通过添加一些企业必需的功能特性,例如安全.标识和管理等,扩展了开源 Docke ...

  10. Python Docker 查看私有仓库镜像【转】

    文章来源:python Docker 查看私有仓库镜像 pip 安装: # 首先安装epel扩展源: yum -y install epel-release # 更新完成之后,就可安装pip: yum ...

随机推荐

  1. C语言学习之基本数据类型【一】

    近期学习鸿蒙硬件物联网开发,用到的开发语言是C: 一.基础语法:第一个案例: 命令 gcc hello.c #include <stdio.h> //stdio.h 是一个头文件 , #i ...

  2. odoo14通过命令行启动以及报错进不去系统问题解决办法

    一.通过CMD命令界面启动odoo:进入odoo-bin目录下:执行 python odoo-bin -c odoo.conf  二.pycharm配置自动安装升级模块:-c E:\odoo14\od ...

  3. 浏览器WEB Browser 常识

    浏览器WEB Browser 浏览器发展史 浏览器诞生与发展 浏览器的诞生 早期浏览器 Netscape Internet Explorer 与浏览器战争 chrome的崛起 时代之泪 IE浏览器终成 ...

  4. maven 与profile,resources,properties 关系

    top 的 pom.xml 看<profiles>的标签 <profiles> <!--dat环境--> <profile> <id>DAT ...

  5. ECMAScript 2020(ES11)新特性简介

    目录 简介 动态imports import.meta export加强 BigInt matchAll() globalThis Promise.allSettled() ??操作符 ?.操作符 总 ...

  6. 在阿里云上单机部署k8s

    系统:CentOS Linux release 8.1.1911 配置主机名 [root@iZwz9e3t4tj14jzewdtvj8Z ~]# hostnamectl set-hostname la ...

  7. 如何从二维平面n个点中寻找距离最近两个点?

    如何理解分治算法 什么是分治算法?简单来说就是"分而治之",也就是将原问题划分成n个规模较小的,并且结构与原问题相似的子问题,然后去递归地解决这些子问题,最后再合并其结果,就得到原 ...

  8. vue日记②之兼容各种情况的可跳转链接

    兼容各种情况的可跳转链接 需求 因为聊天气泡颜色原因,发送出去的链接通常模糊不清,而且不能直接跳转,所以我打算已a链接的显示直接抓取所有的网页链接,同时还要兼容富文本框的直接输入图片 这是运行效果 实 ...

  9. 针对不同场景的Python合并多个Excel方法

    大家好,我是辰哥~ 在辰哥看来,技术能够减少繁琐工作带来的枯燥,技术+实际=方便.最近辰哥也是在弄excel文件的时候发现手动去整理有点繁琐枯燥,想着技术可以代替我去处理这部分繁琐的工作那何乐而不为呢 ...

  10. Linux命令(八)之安装Jdk、Tomcat

    .personSunflowerP { background: rgba(51, 153, 0, 0.66); border-bottom: 1px solid rgba(0, 102, 0, 1); ...