Skip to main content

Building an image and testing it in Lima

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

Prerequisites

Procedure

  1. Build your image:

    1. Go to Images from the left navigation pane.
    2. Click Build.
    3. Provide the relevant details, such as Containerfile path, Image name, and Build arguments to build the image. For example, use the image name my-custom-image.
    4. Click Build. Wait for the image build to finish. building an image
    5. Click Done to view the new image on the same page.
  2. Push your image to your Lima cluster (if needed):

    1. Click the overflow menu icon corresponding to my-custom-image and select Push image to Lima cluster. A successful operation notification opens.
    2. Click OK.
  3. Test your image by creating a container:

    1. Click the Run Image icon corresponding to the image my-custom-image. running an image
    2. Container name: enter my-custom-image-container.
    3. Review the parameters that Podman Desktop has detected from your image definition or edit them, if required.
    4. Click Start Container. starting a container
    5. Select the Summary tab to view the details of the new container.
    6. Click the Close icon.
  4. Test your image and container on your Lima cluster:

    1. Click the overflow menu icon corresponding to the container and select Deploy to Kubernetes. deploying to Kubernetes
    2. Provide the following details:
      • Pod Name: Keep the proposed value my-custom-image-container-pod.
      • Expose service locally using Kubernetes Ingress: Select the checkbox to expose the service locally using the ingress controller.
      • Optional: If your container exposes more than one port, select the port to expose from the dropdown list.
    3. Click Deploy. Wait for the pod to reach the state: Phase: Running.
    4. Click Done.

Verification

  1. Go to Kubernetes > Pods from the left navigation pane.
  2. View the running my-custom-image-container-pod pod. running pod
  3. Click the pod name to view its details and logs.
  4. Optional: If your container exposes a port, go to http://localhost:<port-number-exposed>: your application is running.

Additional resources

You can build and test your image in the same Lima instance, you don't need to push it!

List of common Docker API and Kubernetes CRI sockets that you can install and configure:

Docker API socketKubernetes CRI socket
nerdctl.sockcontainerd.sock
docker.sockcri-dockerd.sock
podman.sockcrio.sock