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

相关文章
|
4天前
|
Java Docker 微服务
SpringBoot微服务打包Docker镜像
SpringBoot微服务打包Docker镜像
28 11
|
4天前
|
Docker 容器
用Docker发布自己的镜像
用Docker发布自己的镜像
34 9
|
6天前
|
存储 安全 Ubuntu
docker中的镜像
【10月更文挑战第1天】
22 4
|
4天前
|
缓存 安全 Linux
docker镜像管理问题
【10月更文挑战第3天】
30 1
|
6天前
|
Docker 容器
docker的导入本地镜像和导出本地镜像
本文介绍了如何使用Docker对本地镜像进行导入和导出操作,包括从本地导入`nginx.tar`镜像以及将`open-webui`镜像导出并压缩为`open-webui.tar.gz`。
19 1
|
4天前
|
NoSQL MongoDB Docker
求助,有没有大神可以找到arm64架构下mongodb的3.6.8版本的docker镜像?
在Docker Hub受限的情况下,寻求适用于ARM架构的docker镜像资源或拉取链接,以便在x86架构上获取;内网中的机器为ARM架构,因此优先请求适合ARM的Docker镜像或Dockerfile,非常感激您的帮助。
|
6天前
|
网络协议 应用服务中间件 nginx
私有的docker私有镜像站仓库harbor
私有的docker私有镜像站仓库harbor
|
3天前
|
网络协议 网络安全 Docker
docker容器间无法通信
【10月更文挑战第4天】
13 3
|
2天前
|
Docker 容器
docker中检查容器的网络模式
【10月更文挑战第5天】
5 1