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

开发者社区> 问答> 正文

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

k8s小能手 2019-01-11 14:05:22 2011

我有一个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'

存储 Kubernetes Docker 容器 Perl
分享到
取消 提交回答
全部回答(1)
  • k8s小能手
    2019-07-17 23:25:19

    看起来您在容器图像字符串中缺少用户或组。据我所知,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
    0 0
云原生
使用钉钉扫一扫加入圈子
+ 订阅

云原生时代,是开发者最好的时代

推荐文章
相似问题
推荐课程