Henry
发布于 2025-02-26 / 20 阅读
0
0

Containerd - 拉取镜像时附带账号密码

背景简介

在拉取 Docker 私有镜像服务时,需要使用账号密码,本文记录了如何在拉取镜像时临时配置账号密码。

环境信息

  1. containerd v1.7.14 【Containerd - 安装

详细步骤

第一步: 拉取镜像是添加 --user 参数即可

$ sudo ctr image pull --user your_username your-private-repo.com/nginx:alpine

Password: 
your-private-repo.com/nginx:alpine:                                               resolved       manifest-sha256:2d2a2257c6e9d2e5b50d4fbeb436d8d2b55631c2a89935a425b417eb95212686: done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:fe117667dcd024947ead1f25ad99a5e522efcf3b7dbd0752b6fb5e73feffb407:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:8695c106552e600555fefc1bc2b299b420c52583bbf537e6c0468bc7821a3f7b:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:dffa16519b51a7abc6df8837b2ceffb699eedd09394ecfeff363ae5321cb7ad2:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:d4735778d47c0be8db66c446904aa2ba47f3e7509c0c9c3985ecb3b96bb7179f:    done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:529b5644c430c06553d2e8082c6713fe19a4169c9dc2369cbb960081f52924ff:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:c926b61bad3b94ae7351bafd0c184c159ebf0643b085f7ef1d47ecdc7316833c:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:fed54a1dc458a7f591fa1c986669998655ad54d260d53691c8ef4841185883d4:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:9e50a0e580b1e5240c8bf21f791b11fb7a8f3c04249f5db56f1bc72f2fa73929:    done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:5ddd532e9cec09472cd07e594cb6dce78c43ba5248310263f8f766c74b9fb6ae:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 52.7s                                                                    total:  17.1 M (333.0 KiB/s)                                     
unpacking linux/amd64 sha256:2d2a2257c6e9d2e5b50d4fbeb436d8d2b55631c2a89935a425b417eb95212686...
done: 1.798730046s
  • ctr: 这是 containerd 的命令行客户端。containerd 是一个开源的容器运行时,它管理容器的生命周期,提供诸如容器镜像的拉取、存储、管理等操作。
  • image pull: 这是 ctr 命令中的子命令,用于从远程仓库中拉取容器镜像。
  • --user your_username: 这个选项用于指定用于认证的用户名。当从一个私有仓库拉取镜像时,通常需要提供用户名和密码进行认证。
  • your-private-repo.com/nginx:alpine: 这是镜像的地址,your-private-repo.com 是私有仓库的地址,nginx 是镜像名称,alpine 是镜像版本。
  • Password : 执行指令后会提示输入密码继续。

以上便是本文的全部内容,感谢您的阅读,如遇到任何问题,欢迎在评论区留言,我会通过邮件回复。



评论