Local Docker Images on Kubernetes – Docker for Windows

Failed to pull image “testapp:latest”: rpc error: code = Unknown desc = Error response from daemon: pull access denied for testapp, repository does not exist or may require ‘docker login’

Why??? It is there…

I just installed Docker for Windows + Kubernetes on my PC because I wanted to test some changes I made to the Kubernetes C# client, so I quickly created an easy .Net Core Console App and made an image with:

FROM microsoft/dotnet:2.1-sdk-alpine AS build 
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

FROM microsoft/dotnet:2.1-runtime-alpine AS runtime
WORKDIR /app
COPY --from=build /app/out ./
ENTRYPOINT ["dotnet", "TestApp.dll"]

Then I built it with:

docker build -t testapp .

Checked the images in docker:

Good, it is in my local image store. So I could run it now in Kubernetes with the Kube file I created:

apiVersion: batch/v1
kind: Job
metadata:
  name: testapp-job
  labels:
    app: testapp
spec:
 template:
   spec:
      containers:
      - name: testapp-job
        image: testapp:v1
      restartPolicy: Never

So I ran:

kubectl create -f .\Kube.yml

And checked the Kubernetes Dashboard:

Well it has nothing to do with the login or the repository. It’s more about the tag, it makes Kubernetes not look into your local store for some reason.

How do you fix this:

Just apply a different tag and use that. As simple as that.

Continue reading “Local Docker Images on Kubernetes – Docker for Windows”