From 3f9103c8aad311f974f1657ccc12354b1ea400f7 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Thu, 15 Apr 2021 01:15:01 -0700 Subject: [PATCH] buildkit: support concurrent starts Signed-off-by: Andrea Luzzardi --- pkg/buildkitd/buildkitd.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pkg/buildkitd/buildkitd.go b/pkg/buildkitd/buildkitd.go index e3b93f82..f6effa61 100644 --- a/pkg/buildkitd/buildkitd.go +++ b/pkg/buildkitd/buildkitd.go @@ -116,13 +116,18 @@ func startBuildkit(ctx context.Context) error { ) output, err = cmd.CombinedOutput() if err != nil { - log. - Ctx(ctx). - Error(). - Err(err). - Bytes("output", output). - Msg("unable to start buildkitd") - return err + // If the daemon failed to start because it's already running, + // chances are another dagger instance started it. We can just ignore + // the error. + if !strings.Contains(string(output), "Error response from daemon: Conflict.") { + log. + Ctx(ctx). + Error(). + Err(err). + Bytes("output", output). + Msg("unable to start buildkitd") + return err + } } return waitBuildkit(ctx) }