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