From 10bdc7136c1af9cd1c79c6068ce0699eb0536a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Thu, 14 Mar 2024 17:33:08 +0100 Subject: [PATCH] builder-next: Add env-var to override runc used by buildkit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an experimental `DOCKER_BUILDKIT_RUNC_COMMAND` variable that allows to specify different runc-compatible binary to be used by the buildkit's runc executor. This allows runtimes like sysbox be used for the containers spawned by buildkit. Signed-off-by: Paweł Gronowski --- builder/builder-next/executor_linux.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/builder/builder-next/executor_linux.go b/builder/builder-next/executor_linux.go index 6bd1bbb981..bdbf45139f 100644 --- a/builder/builder-next/executor_linux.go +++ b/builder/builder-next/executor_linux.go @@ -56,9 +56,16 @@ func newExecutor(root, cgroupParent string, net *libnetwork.Controller, dnsConfi return nil, err } + runcCmds := []string{"runc"} + + // TODO: FIXME: testing env var, replace with something better or remove in a major version or two + if runcOverride := os.Getenv("DOCKER_BUILDKIT_RUNC_COMMAND"); runcOverride != "" { + runcCmds = []string{runcOverride} + } + return runcexecutor.New(runcexecutor.Opt{ Root: filepath.Join(root, "executor"), - CommandCandidates: []string{"runc"}, + CommandCandidates: runcCmds, DefaultCgroupParent: cgroupParent, Rootless: rootless, NoPivot: os.Getenv("DOCKER_RAMDISK") != "",