skip to Main Content

I would like to run a CI/CD (lets say selfhosted github runners) inside kubernetes

some workflows require to build docker images

but apparently you cannot just mount /var/run/docker.sock to k8s pod – as newer versions of k8s do not have it(?)

what’s the solution to simply building images (not running – only building Dockerfile and push to registry)

2

Answers


  1. You can use Docker in Docker (DIND) building method. Kaniko is one of the tools which will do it

    Login or Signup to reply.
  2. I agree with Mr deHaar, larsks and Shmuel’s comments.

    Kaniko is a tool specifically designed to build container images from a Dockerfile inside a container, without requiring a Docker daemon.

    Another container image builder is Buildah (Podman) that can be used within a pod. It’s often included with Podman, a container runtime tool. Similar to Kaniko, Buildah also offers a secure approach to building images.

    Both Kaniko and Buildah offer similar functionalities. Kaniko might be a better choice if you prioritize a tool specifically designed for building images within containers. If your environment already uses Podman for container management, Buildah might be more convenient.

    Just make sure your GitHub Runner pods have the necessary permissions to access the dockerfile and build context volume mounts. Configure proper authentication for pushing the built image to your registry.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search