<p>My story is:</p>
<p>1, I create a spring-boot project, with a Dockerfile inside.
2, I successfully create the docker image IN LOCAL with above docker file.
3, I have a minikube build a K8s for my local.
4, However, when I try to apply the k8s.yaml, it tells me that there is no such docker image. Obviously my docker app search in public docker hub, so what I can do?</p>
<p>Below is my dockerfile</p>
<pre><code>FROM openjdk:17-jdk-alpine
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
expose 8080
ENTRYPOINT [&quot;java&quot;,&quot;-jar&quot;,&quot;/app.jar&quot;]
</code></pre>
<p>Below is my k8s.yaml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: pkslow-springboot-deployment
spec:
  selector:
    matchLabels:
      app: springboot
  replicas: 2
  template:
    metadata:
      labels:
        app: springboot
    spec:
      containers:
        - name: springboot
          image: cicdstudy/apptodocker:latest
          ports:
            - containerPort: 8080

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: springboot
  name: pkslow-springboot-service
spec:
  ports:
    - port: 8080
      name: springboot-service
      protocol: TCP
      targetPort: 8080
      nodePort: 30080
  selector:
    app: springboot
  type: NodePort
</code></pre>

JoseLuis
<p>if you just want to be able to pull images from your local computer with minikube you can use <code>eval $(minikube docker-env)</code> this leads to all docker related commands being used on your minikube cluster to use your local docker daemon. so a pull will first look in your hosts local images instead of hub.docker.io.</p>
<p>more information can be found <a href="https://shashanksrivastava.medium.com/how-to-set-up-minikube-to-use-your-local-docker-registry-10a5b564883" rel="nofollow noreferrer">here</a></p>
