mirror of https://github.com/docker/compose.git
introduce --no-deps on restart
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
92e0cd4047
commit
0612b34c68
|
@ -28,6 +28,7 @@ import (
|
|||
type restartOptions struct {
|
||||
*ProjectOptions
|
||||
timeout int
|
||||
noDeps bool
|
||||
}
|
||||
|
||||
func restartCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
|
||||
|
@ -44,6 +45,7 @@ func restartCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
|
|||
}
|
||||
flags := restartCmd.Flags()
|
||||
flags.IntVarP(&opts.timeout, "timeout", "t", 10, "Specify a shutdown timeout in seconds")
|
||||
flags.BoolVar(&opts.noDeps, "no-deps", false, "Don't restart dependent services.")
|
||||
|
||||
return restartCmd
|
||||
}
|
||||
|
@ -54,6 +56,13 @@ func runRestart(ctx context.Context, backend api.Service, opts restartOptions, s
|
|||
return err
|
||||
}
|
||||
|
||||
if opts.noDeps {
|
||||
err := withSelectedServicesOnly(project, services)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
timeout := time.Duration(opts.timeout) * time.Second
|
||||
return backend.Restart(ctx, name, api.RestartOptions{
|
||||
Timeout: &timeout,
|
||||
|
|
|
@ -7,6 +7,7 @@ Restart service containers
|
|||
|
||||
| Name | Type | Default | Description |
|
||||
|:------------------|:------|:--------|:--------------------------------------|
|
||||
| `--no-deps` | | | Don't restart dependent services. |
|
||||
| `-t`, `--timeout` | `int` | `10` | Specify a shutdown timeout in seconds |
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,16 @@ usage: docker compose restart [OPTIONS] [SERVICE...]
|
|||
pname: docker compose
|
||||
plink: docker_compose.yaml
|
||||
options:
|
||||
- option: no-deps
|
||||
value_type: bool
|
||||
default_value: "false"
|
||||
description: Don't restart dependent services.
|
||||
deprecated: false
|
||||
hidden: false
|
||||
experimental: false
|
||||
experimentalcli: false
|
||||
kubernetes: false
|
||||
swarm: false
|
||||
- option: timeout
|
||||
shorthand: t
|
||||
value_type: int
|
||||
|
|
Loading…
Reference in New Issue