From 21d3b19e57565be3cf89a61c8d521a8f3bec13c6 Mon Sep 17 00:00:00 2001 From: aviau Date: Tue, 14 Sep 2021 13:22:07 -0400 Subject: [PATCH] compose/run: don't waitDependencies if NoDeps Signed-off-by: aviau --- cmd/compose/run.go | 1 + pkg/api/api.go | 1 + pkg/compose/run.go | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/compose/run.go b/cmd/compose/run.go index e019ad477..7bc3d4ba4 100644 --- a/cmd/compose/run.go +++ b/cmd/compose/run.go @@ -210,6 +210,7 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op Entrypoint: opts.entrypointCmd, Labels: labels, UseNetworkAliases: opts.useAliases, + NoDeps: opts.noDeps, Index: 0, } exitCode, err := backend.RunOneOffContainer(ctx, project, runOpts) diff --git a/pkg/api/api.go b/pkg/api/api.go index 081934388..3e3df639e 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -220,6 +220,7 @@ type RunOptions struct { Labels types.Labels Privileged bool UseNetworkAliases bool + NoDeps bool // used by exec Index int } diff --git a/pkg/compose/run.go b/pkg/compose/run.go index 3067bdce0..cf7281f93 100644 --- a/pkg/compose/run.go +++ b/pkg/compose/run.go @@ -160,8 +160,10 @@ func (s *composeService) prepareRun(ctx context.Context, project *types.Project, if err := s.ensureImagesExists(ctx, project, false); err != nil { // all dependencies already checked, but might miss service img return "", err } - if err := s.waitDependencies(ctx, project, service); err != nil { - return "", err + if !opts.NoDeps { + if err := s.waitDependencies(ctx, project, service); err != nil { + return "", err + } } created, err := s.createContainer(ctx, project, service, service.ContainerName, 1, opts.Detach && opts.AutoRemove, opts.UseNetworkAliases) if err != nil {