1

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?

romanzdk
  • 930
  • 11
  • 30
  • 2
    have you considered using VMSS agent pools instead? they can autoscale (all the way to zero) and you wont have to go through any hassle of docker-in-docker https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/scale-set-agents?view=azure-devops – silent Apr 20 '22 at 15:34

1 Answers1

2

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

romanzdk
  • 930
  • 11
  • 30