开发者社区> 问答> 正文

无法提取图片:对gin-web拒绝访问权限,存储库不存在或者可能需要“docker login”

我有一个Docker镜像gin-web,我在本地也可以推送到Docker Hub。当我在运行我的Kubernetes文件夹时,即Kubernetes/我的错误k8s-deployment.yml

Kubernetes由 控制台组成k8s-deployment.yml和k8s-service.yml服务。(使用minikube dashboard)。

我已经将已配置的Pod引用从私有注册表中提取图像并添加imagePullSecrets到k8-deployment.yml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: gin-web # Enter deployment name
labels:
app: gin-web
spec:

replicas: 3 #Enter the number of replicas
template:

metadata:
  labels:
    app: gin-web
    tier: service
spec:
  imagePullSecrets:
  - name: regcred 
  containers:
  - name: gin-web
    image: "gin-web:1.0.1"
    ports:
    - containerPort: 9090
    env:
    - name: PORT
      value: "9090"  

    # define resource requests and limits
    resources:
      requests:
        memory: "64Mi"
        cpu: "125m"
      limits: #k8 automatically restart container when hit with these Limtis
        memory: "128Mi"
        cpu: "250m"

     # check if gin-web is alive and healthy

     #Check if MS recieve traffic from k*
    readinessProbe:
      httpGet:
        path: /ping
        port: 9090
      initialDelaySeconds: 5
      timeoutSeconds: 5
      # check for k8 if container is healthy
    livenessProbe:
      httpGet: 
        path: /ping
        port: 9090
      initialDelaySeconds: 5
      timeoutSeconds: 5

我在Kubernetes控制台中的Deployments下遇到此错误:

Failed to pull image "gin-web:1.0.1": rpc error: code = Unknown desc = Error response from daemon: pull access denied for gin-web, repository does not exist or may require 'docker login'

展开
收起
k8s小能手 2019-01-11 14:05:22 4361 1
1 条回答
写回答
取消 提交回答
  • 整合最优质的专家资源和技术资料,问答解疑

    看起来您在容器图像字符串中缺少用户或组。据我所知,docker hub中的任何内容都不是简单的gin-web:

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
    name: gin-web # Enter deployment name
    labels:
    app: gin-web
    spec:

    replicas: 3 #Enter the number of replicas
    template:

    metadata:
      labels:
        app: gin-web
        tier: service
    spec:
      imagePullSecrets:
      - name: regcred 
      containers:
      - name: gin-web
        image: "<your-user>/gin-web:1.0.1" <== Add user here
        ports:
        - containerPort: 9090
        env:
        - name: PORT
          value: "9090"  
    
        # define resource requests and limits
        resources:
          requests:
            memory: "64Mi"
            cpu: "125m"
          limits: #k8 automatically restart container when hit with these Limtis
            memory: "128Mi"
            cpu: "250m"
    
         # check if gin-web is alive and healthy
    
         #Check if MS recieve traffic from k*
        readinessProbe:
          httpGet:
            path: /ping
            port: 9090
          initialDelaySeconds: 5
          timeoutSeconds: 5
          # check for k8 if container is healthy
        livenessProbe:
          httpGet: 
            path: /ping
            port: 9090
          initialDelaySeconds: 5
          timeoutSeconds: 5
    2019-07-17 23:25:19
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Web应用系统性能优化 立即下载
高性能Web架构之缓存体系 立即下载
PWA:移动Web的现在与未来 立即下载