Pulling image into Docker-compose file from docker desktop images?

3/2/2020

I have installed docker desktop and i have an image when i use the command docker images:

JamesGregory@LT-BY1842A489OJ MINGW64 /c/Dev
$docker images
REPOSITORY              TAG  IMAGE ID       CREATED        SIZE
productpricingservice   dev  97be3cef2ce8   5 minutes ago  207MB

When i run the command: kubectl apply -f "C:\Dockerkubernetes\pricingpod.yaml"
The pod is created, but i get an error when pulling the image.

JamesGregory@LT-BY1842A489OJ MINGW64 /c/Dev
$kubectl get pods
NAME               READY   STATUS         RESTARTS   AGE
demo               1/1     Running        0          2d19h
pricingpodworking  0/1     ErrImagePull   0          14s

This is my yaml file, how do i get the docker image to be pulled into the compose file:

apiVersion: v1
kind: Pod
metadata:
  name: pricingpodworking
spec:
  containers:
  - name: productpricingcontainer
    image: productpricingservice:dev

The error i am getting using the desc command is: Failed to pull image "productpricingservice": rpc error: code = Unknown desc = Error response from daemon: pull access denied for productpricingservice, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

It Seems adding your docker desktop name to the front of your image is a requirment e.g. jamesgregor7/imagename:tag.

-- Hawkzey
docker
docker-desktop
kubernetes

1 Answer

3/2/2020

I faced a similar issue this week. Kubernetes try to pull images (even if is available on the node) because imagePullPolicy property has default value always k8s is trying to do docker login to compare images first. (i am not sure though)

setting up imagePullPolicy to never or idNotPresent for such case worked for me.

-- Guru
Source: StackOverflow