Reputation: 9183
I'm trying to use a local image on minikube. In order to build the image I run the following command
docker build -t goserver:1.0.0 .
My yaml file for minikube contains the following
apiVersion: apps/v1
kind: Deployment
metadata:
name: goserver
namespace: golang-ns
labels:
app: goserver
spec:
replicas: 1
selector:
matchLabels:
app: goserver
template:
metadata:
labels:
app: goserver
spec:
containers:
- name: goserver
image: goserver:1.0.0
imagePullPolicy: Never
ports:
- containerPort: 8080
However when I try `kubectl apply -f ./k8s.yaml, I get the following error
Container image "goserver:1.0.0" is not present with pull policy of Never
Error: ErrImageNeverPull
I did a bit of searching and I found the following
How to use local docker images with Minikube?
And as per this I ran eval $(minikube docker-env)
, but I still get this error.
Is what I am trying to do possible or do I need to push this to docker hub?
Upvotes: 1
Views: 430
Reputation: 5517
When you run eval $(minikube docker-env)
you will get the docker-engine of the minikube installation.
In some environments, your local docker-engine could be the same one with minikube, however in most cases it's not. It depends on the drivers settings if the both engines are same.
In case where the engines are different, you will need to set the minikube environment with eval $(minikube docker-env)
and than build the image.
Upvotes: 1