mirror of https://github.com/docker/compose.git
introduce run —quiet-pull to align with up
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
10cd7e130f
commit
cbd3d37adf
|
@ -54,6 +54,7 @@ type runOptions struct {
|
||||||
servicePorts bool
|
servicePorts bool
|
||||||
name string
|
name string
|
||||||
noDeps bool
|
noDeps bool
|
||||||
|
quietPull bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opts runOptions) apply(project *types.Project) error {
|
func (opts runOptions) apply(project *types.Project) error {
|
||||||
|
@ -153,6 +154,7 @@ func runCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
||||||
flags.StringArrayVarP(&opts.publish, "publish", "p", []string{}, "Publish a container's port(s) to the host.")
|
flags.StringArrayVarP(&opts.publish, "publish", "p", []string{}, "Publish a container's port(s) to the host.")
|
||||||
flags.BoolVar(&opts.useAliases, "use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to.")
|
flags.BoolVar(&opts.useAliases, "use-aliases", false, "Use the service's network useAliases in the network(s) the container connects to.")
|
||||||
flags.BoolVar(&opts.servicePorts, "service-ports", false, "Run command with the service's ports enabled and mapped to the host.")
|
flags.BoolVar(&opts.servicePorts, "service-ports", false, "Run command with the service's ports enabled and mapped to the host.")
|
||||||
|
flags.BoolVar(&opts.quietPull, "quiet-pull", false, "Pull without printing progress information.")
|
||||||
|
|
||||||
flags.SetNormalizeFunc(normalizeRunFlags)
|
flags.SetNormalizeFunc(normalizeRunFlags)
|
||||||
flags.SetInterspersed(false)
|
flags.SetInterspersed(false)
|
||||||
|
@ -215,6 +217,7 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
|
||||||
UseNetworkAliases: opts.useAliases,
|
UseNetworkAliases: opts.useAliases,
|
||||||
NoDeps: opts.noDeps,
|
NoDeps: opts.noDeps,
|
||||||
Index: 0,
|
Index: 0,
|
||||||
|
QuietPull: opts.quietPull,
|
||||||
}
|
}
|
||||||
exitCode, err := backend.RunOneOffContainer(ctx, project, runOpts)
|
exitCode, err := backend.RunOneOffContainer(ctx, project, runOpts)
|
||||||
if exitCode != 0 {
|
if exitCode != 0 {
|
||||||
|
|
|
@ -227,6 +227,8 @@ type RunOptions struct {
|
||||||
Privileged bool
|
Privileged bool
|
||||||
UseNetworkAliases bool
|
UseNetworkAliases bool
|
||||||
NoDeps bool
|
NoDeps bool
|
||||||
|
// QuietPull makes the pulling process quiet
|
||||||
|
QuietPull bool
|
||||||
// used by exec
|
// used by exec
|
||||||
Index int
|
Index int
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ func (s *composeService) prepareRun(ctx context.Context, project *types.Project,
|
||||||
service.Labels = service.Labels.Add(api.SlugLabel, slug)
|
service.Labels = service.Labels.Add(api.SlugLabel, slug)
|
||||||
service.Labels = service.Labels.Add(api.OneoffLabel, "True")
|
service.Labels = service.Labels.Add(api.OneoffLabel, "True")
|
||||||
|
|
||||||
if err := s.ensureImagesExists(ctx, project, false); err != nil { // all dependencies already checked, but might miss service img
|
if err := s.ensureImagesExists(ctx, project, opts.QuietPull); err != nil { // all dependencies already checked, but might miss service img
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if !opts.NoDeps {
|
if !opts.NoDeps {
|
||||||
|
|
Loading…
Reference in New Issue