docker镜像上传至Harbor及从Harbor下载

简介: docker镜像上传至Harbor及从Harbor下载

docker镜像上传至Harbor及从Harbor下载
合集 - docker(15)
1.
docker 系统架构
09-06
2.
docker的安装
09-06
3.
docker 初步使用
09-06
4.
docker 容器的操作命令选项
09-07
5.
★ docker镜像的常见操作
09-22
6.
docker 构建镜像
09-07
7.
docker镜像存储驱动方式
09-27
8.
docker 镜像和容器的关系
09-28
9.
docker 容器内写文件
10-08
10.
私有的docker私有镜像站仓库harbor
10-09
11.
docker镜像上传至Harbor及从Harbor下载
10-11
12.
Dockerfile指令
09-09
13.
docker 容器端口与数据卷
09-12
14.
Docker的共享数据和数据容器
09-19
15.
★ docker的常见操作
09-19
收起
▶ 修改 docker daemon 使用 harbor
▷ 安装 harbor 的主机
在 harbor 的主机中配置。

添加 /etc/docker/daemon.json 文件,默认不存在,需要手动添加。

[root@server harbor]# vim /etc/docker/daemon.json

[root@server harbor]# cat /etc/docker/daemon.json
{
"insecure-registries":["https://www.harborexample.com"]
}
重新加载 daemon 配置。

[root@server harbor]# systemctl daemon-reload
[root@server harbor]# systemctl restart docker
由于是重启 docker 所以 harbor 的9个容器可能会停止,这就需要使用 docker-compose 来使用。

[root@server harbor]# pwd
/home/harbor

[root@server harbor]# docker-compose down
[root@server harbor]# docker-compose up -d

▶ docker push
在其他的安装了docker的主机中,依旧需要在 /etc/docker/daemon.json 文件来配置。

[root@server ~]# vi /etc/docker/daemon.json

[root@server ~]# cat /etc/docker/daemon.json
{
"insecure-registries":["https://www.harborexample.com"]
}

制作准备要 push 的镜像,给该镜像打 tag:

[root@server ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 7f553e8bbc89 8 days ago 192MB

[root@server ~]# docker tag nginx:latest www.harborexample.com/library/ngnix:v1
[root@server ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
www.harborexample.com/library/ngnix v1 7f553e8bbc89 8 days ago 192MB
nginx latest 7f553e8bbc89 8 days ago 192MB
docker tag 镜像 寄存服务registry/仓库repository/镜像:tag

登陆 harbor:

[root@server ~]# docker login https://www.harborexample.com
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/#credential-stores

Login Succeeded

docker push 的具体操作:

[root@server ~]# docker push www.harborexample.com/library/ngnix:v1
The push refers to repository [www.harborexample.com/library/ngnix]
825fb68b6033: Pushed
7619c0ba3c92: Pushed
1c1f11fd65d6: Pushed
6b133b4de5e6: Pushed
3d07a4a7eb2a: Pushed
756474215d29: Pushed
8d853c8add5d: Pushed
v1: digest: sha256:719b34dba7bd01c795f94b3a6f3a5f1fe7d53bf09e79e355168a17d2e2949cef size: 1778
此时在浏览器中查看:

[kod.tongfengstone.com)
[kod.bn47.com)
[kod.ybmqyz.com)
[kod.scacllc.com)
[kod.zhaimeizi.com)
[kod.710082.com)
[kod.gd-yuejin.com)
[kod.512aiai.com)

▶ docker pull
对于要对自己内部的harbor来使用 docker pull,在这之前需要对 /etc/hosts 和 /etc/docker/daemon.json 做配置。

[root@server ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.10 www.harborexample.com

[root@server ~]# cat /etc/docker/daemon.json
{
"insecure-registries":["https://www.harborexample.com"]
}
[root@server ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE

此时并没有镜像的存在。

指定 www.harborexample.com 的来拉取镜像。

[root@server ~]# docker pull www.harborexample.com/library/ngnix:v1
v1: Pulling from library/ngnix
302e3ee49805: Pull complete
d07412f52e9d: Pull complete
9ab66c386e9c: Pull complete
4b563e5e980a: Pull complete
55af3c8febf2: Pull complete
5b8e768fb22d: Pull complete
85177e2c6f39: Pull complete
Digest: sha256:719b34dba7bd01c795f94b3a6f3a5f1fe7d53bf09e79e355168a17d2e2949cef
Status: Downloaded newer image for www.harborexample.com/library/ngnix:v1
www.harborexample.com/library/ngnix:v1
[root@server ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
www.harborexample.com/library/ngnix v1 7f553e8bbc89 8 days ago 192MB
合集: docker

相关文章
|
1天前
|
消息中间件 Kafka 流计算
docker环境安装kafka/Flink/clickhouse镜像
通过上述步骤和示例,您可以系统地了解如何使用Docker Compose安装和配置Kafka、Flink和ClickHouse,并进行基本的验证操作。希望这些内容对您的学习和工作有所帮助。
41 28
|
1月前
|
Ubuntu NoSQL 开发工具
《docker基础篇:4.Docker镜像》包括是什么、分层的镜像、UnionFS(联合文件系统)、docker镜像的加载原理、为什么docker镜像要采用这种分层结构呢、docker镜像commit
《docker基础篇:4.Docker镜像》包括是什么、分层的镜像、UnionFS(联合文件系统)、docker镜像的加载原理、为什么docker镜像要采用这种分层结构呢、docker镜像commit
207 70
|
14天前
|
网络协议 Linux 网络安全
docker centos镜像 npm安装包时报错“npm ERR! code ECONNRESET”
通过上述步骤,您可以有效解决在 Docker 中使用 CentOS 镜像安装 npm 包时遇到的 "npm ERR! code ECONNRESET" 错误。希望这些方法能帮助您顺利进行 npm 包的安装。
90 26
|
1月前
|
存储 Docker 容器
Docker-基础(数据卷、自定义镜像、Compose)
通过数据卷实现持久化存储,通过自定义镜像满足特定需求,通过Docker Compose方便地管理多容器应用
85 27
|
1月前
|
安全 数据安全/隐私保护 Docker
docker私有仓库harbor安装
通过以上步骤,您可以成功在企业内部安装和配置Harbor私有仓库,方便地管理和分发Docker镜像。Harbor不仅提供了基础的镜像管理功能,还增强了安全性、身份管理和审计功能,使其成为企业级容器镜像管理的理想选择。
98 22
|
1月前
|
Ubuntu NoSQL Linux
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
156 6
《docker基础篇:3.Docker常用命令》包括帮助启动类命令、镜像命令、有镜像才能创建容器,这是根本前提(下载一个CentOS或者ubuntu镜像演示)、容器命令、小总结
|
1月前
|
存储 Docker 容器
Docker-基础(数据卷、自定义镜像、Compose)
通过数据卷实现持久化存储,通过自定义镜像满足特定需求,通过Docker Compose方便地管理多容器应用。掌握这些Docker基础概念和操作,可以显著提高开发和部署效率,确保应用程序的可移植性和可扩展性。
74 22
|
6月前
|
存储 安全 Ubuntu
Docker 镜像与 Docker 容器的区别
【8月更文挑战第27天】
481 5
|
6月前
|
存储 Ubuntu 应用服务中间件
在Docker中,怎么快速查看本地的镜像和容器?
在Docker中,怎么快速查看本地的镜像和容器?
|
7月前
|
Shell Linux Docker
docker常用命令大全(基础、镜像、容器、数据卷)
这些命令仅仅是 Docker 命令行工具的冰山一角,但对于日常操作来说已经非常全面。通过熟练地使用这些基础命令,用户可以有效地管理 Docker 的镜像、容器、数据卷和网络。随着用户对 Docker 的深入使用,更高级的命令和选项将会变得必需,但上面列出的命令已经为用户提供了一个坚实的起点。对于初学者来说,理解和掌握这些常用命令是深入学习 Docker 的基础。
575 5
docker常用命令大全(基础、镜像、容器、数据卷)