I am using Docker for Desktop and Windows Server Core container. I create a Docker image as follow:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
#Download NodeJs
WORKDIR /downloads
ADD https://nodejs.org/dist/v12.18.3/node-v12.18.3-x64.msi nodejs.msi
#Install NodeJs
RUN msiexec.exe /qn /i nodejs.msi
RUN setx path "%path%;C:\Program Files\nodejs"
I use the commande docker build -t winnode:1.0 .
to create the image, and everything goes well : I see with my VS Code docker extension that my image has been created.
Now I use a Kubernetes yaml file to run my image, as follow:
apiVersion: v1
kind: Service
metadata:
name: winnode-svc
spec:
selector:
app: winnode
tier: webserver
ports:
- port: 3500
name: http
targetPort: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: winnode-dpl
spec:
replicas: 1
selector:
matchLabels:
app: winnode
tier: webserver
template:
metadata:
labels:
app: winnode
tier: webserver
spec:
containers:
- name: winnode
image: winnode:1.0
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8080
However, kubernetes is trying to pull the image from the docker registry, and cannot find it. I get the message ErrImagePull
. I googled it, and answers are talking about the imagePullPolicy
. I have tried IfNotPresent
, I get the same ErrImagePull
. (this is the present example).
If I indicate Never
, I get the error : ErrImageNeverPull
.
What can I do ?
Thanks!
you need to push your winnode image to a repository. Kubernetes is designed to be operated from not a single machine. Set the repo name as your image tag and you'll be good to go
Check carefully at the kubectl
command, it will find the "Client Version", but make sure it listClient Server.
Otherwise if you don't have Client Server enable the Docker Kubernetes cluster. For example install KinD and create your first cluster - windows-wsl.
You can also try to install Minikube. Example how to install minikube and run on windows - install-minikube-windows.
Take a look: docker-desktop-windows, dockerdesktop-vs-minikube.