将镜像推送到注册表
将容器存储在 ECR、GCR 或 Docker Hub 中
将镜像推送到注册表 是 CoddyKit 上的免费 MLOps Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MLOps Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MLOps Academy 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
Where Images Live
The cloud cannot pull an image off your laptop. You first push it to a container registry, a shared place that runtimes can pull from. 🚀
Pick a Registry
Each cloud has its own: AWS uses ECR, Google uses Artifact Registry, and Docker Hub works everywhere. Pick the one near your runtime.
Image Names Carry the Address
A full image name encodes its registry host, repository, and tag. The runtime reads that address to know exactly where to pull from.
registry.example.com/team/model-api:1.0.0Tag Before You Push
Use docker tag to give your local image its full registry name. The push command uses this name to find the destination.
docker tag model-api registry.example.com/team/model-api:1.0.0Log In First
Registries are private by default. Run docker login with your credentials so the daemon is allowed to push and pull images.
docker login registry.example.comPush the Image
Now docker push uploads each layer to the registry. Shared base layers are skipped, so only your new code travels over the wire.
docker push registry.example.com/team/model-api:1.0.0Never Rely on latest
The latest tag is a moving target, so two pulls can give different images. Always deploy a specific, immutable version tag.
Tag by Git Commit
A great trick is tagging images with the git commit SHA. Then any running container traces straight back to the exact source code.
docker tag model-api registry.example.com/team/model-api:$(git rev-parse --short HEAD)Digests Are Truly Immutable
Tags can be overwritten, but a digest is a content hash that never moves. Pin production deploys to a digest for full certainty.
registry.example.com/team/model-api@sha256:9f86d0...Confirm the Pull Works
From a clean machine, run docker pull on the full name. If it downloads cleanly, the cloud runtime will be able to pull it too.
docker pull registry.example.com/team/model-api:1.0.0The Registry Is Your Handoff
Once the image is pushed and tagged, the registry becomes the single source the cloud deploys from. Your handoff to production is done.
Quick Check
Let us check what makes a deploy reproducible.
Recap
You tagged the image, logged in, and pushed it to a registry with an immutable version. The cloud can now pull your model anywhere. 🐳
常见问题解答
「将镜像推送到注册表」课时是免费的吗?
是的 — 「将镜像推送到注册表」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MLOps Academy 课程的其余内容,请升级到 CoddyKit PRO。 MLOps Academy 课程共包含 4 节课。
「将镜像推送到注册表」这节课中我会学到什么?
将容器存储在 ECR、GCR 或 Docker Hub 中 你通过在浏览器中直接运行的动手代码来练习 MLOps Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 MLOps Academy 需要有经验吗?
无需任何先前经验。CoddyKit 上的 MLOps Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。
「将镜像推送到注册表」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 MLOps Academy 课中编写并运行代码吗?
能。每节 MLOps Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。
此课程中的所有课时
- 将镜像推送到注册表
- 部署到无服务器容器运行时
- 配置自动扩缩容和并发
- 在云端管理密钥和配置