My story is:
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?
Below is my dockerfile
FROM openjdk:17-jdk-alpine
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
expose 8080
ENTRYPOINT ["java","-jar","/app.jar"]
Below is my k8s.yaml
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
 
     
    