如何在kubernetes中从dockerhub中提取图像? [英] How to pull image from dockerhub in kubernetes?

查看:142
本文介绍了如何在kubernetes中从dockerhub中提取图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正计划在我的kubernetes集群基础设施中部署一个应用程序. 我将映像推送到dockerhub存储库.如何从dockerhub中提取图像?

I am planning to deploy an application in my kubernetes-clustering infra. I pushed image to dockerhub repo. How can I pull image from dockerhub?

推荐答案

创建Docker注册表机密的一行命令

One line command to create a Docker registry secret

kubectl create secret docker-registry regcred --docker-username=<your-name> --docker-password=<your-pword> --docker-email=<your-email> -n <your-namespace>

然后您可以在 spec

spec:
  containers:
  - name: private-reg-container-name
    image: <your-private-image>
  imagePullSecrets:
  - name: regcred

更多详细信息: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that -保留您的授权令牌

这篇关于如何在kubernetes中从dockerhub中提取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆