Search code examples
azuredockerazure-devopsazure-devops-self-hosted-agentkaniko

Azure DevOps self-hosted build agent - Kaniko


We need to build docker images using self-hosted linux agent which is deployed as docker container (in Azure Container Instances).

As of now, the agent is Ubuntu image, however to enable building images inside this container I thought of using Kaniko image. However, I haven't figured out how to run Kaniko image without executing the kaniko itself right away (as we need to run devops agent primarily and run kaniko on-demand).

Any hints? Or better ideas how to build docker images in running docker container?


Solution

  • Solved with following code, however Kaniko does not work as expected when running inside my container (tested the same parameters with kaniko inside my container and in default container and in my container does not work (cannot authenticate to ACR)).

    Might end up with the VMSS DevOps agent...

    FROM whatever-base-image
    ...
    COPY --from gcr.io/kaniko-project/executor /kaniko/executor /kaniko/executor
    

    Ref: https://github.com/GoogleContainerTools/kaniko/issues/2058#issuecomment-1104666901