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

最新文章

  1. 偶遇this之坑
  2. WDM驱动和NT驱动之我见
  3. SQL Server 数据库备份还原和数据恢复
  4. 单身狗进化——求n!的位数
  5. .emacs
  6. JavaWeb项目开发案例精粹-第6章报价管理系统-07View层
  7. ClassLoader类加载器
  8. 深入Windows窗体原理及控件重绘技巧
  9. C#的垃圾回收机制及弱引用
  10. 「Poetize5」水叮当的舞步
  11. codeforces 620E. New Year Tree dfs序+线段树+bitset
  12. 【环境配置】配置sdk
  13. 从Ubuntu12.04升级到Ubuntu 14.04之后,系统将无法启动
  14. USACO 1.3.2
  15. ionic常用命令记录
  16. 改造 Combo Select支持服务器端模糊搜索
  17. STL-Map 源码剖析
  18. Nginx 安装后 相关错误解决
  19. Git发生SSL certificate problem: certificate ha错误的解决方法
  20. LeetCode 463 Island Perimeter 解题报告

热门文章

  1. python里面的多进程实例
  2. SQL排序包含数字、字母和中文处理
  3. 优化SQL 查询性能
  4. fiddler抓https包教程
  5. OpenStack中VNC协议实现多屏共享(多屏不踢访问)
  6. 线程休眠_sleep
  7. Promise教程及用法
  8. 树莓派远程连接工具VNC使用教程
  9. LiteFlow 2.6.0版本发行注记,项目逻辑解耦的利器
  10. tomcat及springboot实现Filter、Servlet、Listener