无法拉取映像:针对gin-web的拉取访问被拒绝,存储库不存在或可能需要“ docker登录”

时间:2019-01-08 19:25:02

标签: docker kubernetes google-cloud-platform docker-compose containers

我有一个本地的Docker映像gin-web,并且已推送到Docker Hub。在运行Kubernetes文件夹即Kubernetes/时,我的k8s-deployment.yml

出现错误

Kubernetes\k8s-deployment.ymlk8s-service.yml组成 控制台显示服务。(使用minikube dashboard)。

我已推荐configured Pod to pull image from Private Registry并将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控制台中的“部署”下收到此错误:

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'

1 个答案:

答案 0 :(得分:1)

好像您在容器图像字符串中缺少用户或组。据我所知,Docker Hub中没有任何东西只是普通的<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script type="text/javascript" src="https://code.highcharts.com/highcharts-more.js"></script> <script type="text/javascript" src="https://cdn.rawgit.com/highcharts/highcharts-vue/1ce7e656/dist/script-tag/highcharts-vue.min.js"></script> <div id="app"> <div class="title-row"> <p>Insert data series, comma separated</p> <input type="text" v-model="dataSeries"> </div> <highcharts class="hchart":options="chartOptions"></highcharts> </div>

gin-web