Skip to main content

Building an image and testing it in Minikube

With Podman Desktop, you can build an image with your container engine, and test it in your local Minikube-powered Kubernetes cluster.

Prerequisites

Procedure

  1. Build your image:

    1. Open Images > Build an image.
    2. Containerfile path: select your Containerfile or Dockerfile.
    3. Build context directory: optionally, select a directory different from the directory containing your Containerfile or Dockerfile.
    4. Image Name: enter your image name my-custom-image.
    5. Click Build.
    6. Wait for the image build to finish.
    7. Click Done to get back to the images list.
  2. Push your image to your Minikube cluster:

    1. Search images: enter your image name my-custom-image to find the image.
    2. Click > Push image to Minikube cluster.
  3. Test your image by creating a container:

    1. Click to open the Create a container from image dialog.
    2. Container name: enter my-custom-image-container.
    3. Review the parameters that Podman Desktop has detected from your image definition.
    4. Click Start Container to start the container in your container engine.
  4. Test your image and container on your Minikube cluster:

    1. Search containers: enter my-custom-image-container to find the running container.
    2. Click > Deploy to Kubernetes to open the Deploy generated pod to Kubernetes screen.
    3. Pod Name: keep the proposed value my-custom-image-container-pod.
    4. Use Kubernetes Services: select Replace hostPort exposure on containers by Services. It is the recommended way to expose ports, as a cluster policy might prevent to use hostPort.
    5. Expose service locally using Kubernetes LoadBalancer: if your container is exposing a service, you can use minikube service to get a web browser or an URL to use.
    6. Optionally, if your container is exposing more than one port, select the port to expose.
    7. Kubernetes namespaces: select default.
    8. Click Deploy.
    9. Wait for the pod to reach the state: Phase: Running.
    10. Click Done.

Verification

  1. The Pods screen lists the running my-image-container-pod pod.
  2. Click on the pod name to view details and logs.
  3. Optionally, if your container is exposing a service, go to the server URL: your application is running.