diff --git a/pkg/benchmark/benchmark.go b/pkg/benchmark/benchmark.go index b2efb9a..a065090 100644 --- a/pkg/benchmark/benchmark.go +++ b/pkg/benchmark/benchmark.go @@ -123,6 +123,12 @@ var BenchMethods = []method{ command.ClearDockerCache, "image build containerd", }, + { + command.StartMinikubeDockerEnvContainerd, + command.RunDockerEnvWithBuildKitDiabled, + func(s string) error { return nil }, + "docker-env containerd", + }, { command.StartMinikubeRegistryContainerd, command.RunRegistry, diff --git a/pkg/command/dockerenv.go b/pkg/command/dockerenv.go index 3a5664c..0bca369 100644 --- a/pkg/command/dockerenv.go +++ b/pkg/command/dockerenv.go @@ -3,6 +3,7 @@ package command import ( "fmt" "os/exec" + "strings" "time" ) @@ -11,10 +12,20 @@ func StartMinikubeDockerEnv(profile string, args ...string) error { return startMinikube(profile, args...) } +func StartMinikubeDockerEnvContainerd(profile string, args ...string) error { + return startMinikube(profile, "--container-runtime=containerd") +} + // RunDockerEnv builds the provided image using the docker-env method and returns the run time. func RunDockerEnv(image string, profile string) (float64, error) { + return runDockerEnv(image, profile) +} +func RunDockerEnvWithBuildKitDiabled(image string, profile string) (float64, error) { + return runDockerEnv(image, profile, "DOCKER_BUILDKIT=0") +} +func runDockerEnv(image string, profile string, envs ...string) (float64, error) { // build - buildArgs := fmt.Sprintf("eval $(./minikube -p %s docker-env) && docker build -t benchmark-env -f testdata/Dockerfile.%s .", profile, image) + buildArgs := fmt.Sprintf("eval $(./minikube -p %s docker-env) && %s docker build -t benchmark-env -f testdata/Dockerfile.%s .", profile, strings.Join(envs, " "), image) build := exec.Command("/bin/bash", "-c", buildArgs) start := time.Now() if _, err := run(build); err != nil {