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 {