mirror of https://github.com/docker/compose.git
introduce `--ignore-buildable` to ignore buildable images on pull
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
dcbd68a102
commit
8b4ac37f9c
|
@ -37,6 +37,7 @@ type pullOptions struct {
|
||||||
noParallel bool
|
noParallel bool
|
||||||
includeDeps bool
|
includeDeps bool
|
||||||
ignorePullFailures bool
|
ignorePullFailures bool
|
||||||
|
noBuildable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func pullCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
|
func pullCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
|
||||||
|
@ -58,13 +59,14 @@ func pullCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
|
||||||
ValidArgsFunction: completeServiceNames(p),
|
ValidArgsFunction: completeServiceNames(p),
|
||||||
}
|
}
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Pull without printing progress information")
|
flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Pull without printing progress information.")
|
||||||
cmd.Flags().BoolVar(&opts.includeDeps, "include-deps", false, "Also pull services declared as dependencies")
|
cmd.Flags().BoolVar(&opts.includeDeps, "include-deps", false, "Also pull services declared as dependencies.")
|
||||||
cmd.Flags().BoolVar(&opts.parallel, "parallel", true, "DEPRECATED pull multiple images in parallel.")
|
cmd.Flags().BoolVar(&opts.parallel, "parallel", true, "DEPRECATED pull multiple images in parallel.")
|
||||||
flags.MarkHidden("parallel") //nolint:errcheck
|
flags.MarkHidden("parallel") //nolint:errcheck
|
||||||
cmd.Flags().BoolVar(&opts.parallel, "no-parallel", true, "DEPRECATED disable parallel pulling.")
|
cmd.Flags().BoolVar(&opts.parallel, "no-parallel", true, "DEPRECATED disable parallel pulling.")
|
||||||
flags.MarkHidden("no-parallel") //nolint:errcheck
|
flags.MarkHidden("no-parallel") //nolint:errcheck
|
||||||
cmd.Flags().BoolVar(&opts.ignorePullFailures, "ignore-pull-failures", false, "Pull what it can and ignores images with pull failures")
|
cmd.Flags().BoolVar(&opts.ignorePullFailures, "ignore-pull-failures", false, "Pull what it can and ignores images with pull failures.")
|
||||||
|
cmd.Flags().BoolVar(&opts.noBuildable, "ignore-buildable", false, "Ignore images that can be built.")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ func runPull(ctx context.Context, backend api.Service, opts pullOptions, service
|
||||||
}
|
}
|
||||||
|
|
||||||
return backend.Pull(ctx, project, api.PullOptions{
|
return backend.Pull(ctx, project, api.PullOptions{
|
||||||
Quiet: opts.quiet,
|
Quiet: opts.quiet,
|
||||||
IgnoreFailures: opts.ignorePullFailures,
|
IgnoreFailures: opts.ignorePullFailures,
|
||||||
|
IgnoreBuildable: opts.noBuildable,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,12 @@ Pull service images
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|:-------------------------|:-----|:--------|:-------------------------------------------------------|
|
|:-------------------------|:-----|:--------|:--------------------------------------------------------|
|
||||||
| `--ignore-pull-failures` | | | Pull what it can and ignores images with pull failures |
|
| `--ignore-buildable` | | | Ignore images that can be built. |
|
||||||
| `--include-deps` | | | Also pull services declared as dependencies |
|
| `--ignore-pull-failures` | | | Pull what it can and ignores images with pull failures. |
|
||||||
| `-q`, `--quiet` | | | Pull without printing progress information |
|
| `--include-deps` | | | Also pull services declared as dependencies. |
|
||||||
|
| `-q`, `--quiet` | | | Pull without printing progress information. |
|
||||||
|
|
||||||
|
|
||||||
<!---MARKER_GEN_END-->
|
<!---MARKER_GEN_END-->
|
||||||
|
@ -62,3 +63,6 @@ $ docker compose pull db
|
||||||
⠹ 77a0c198cde5 Waiting 9.3s
|
⠹ 77a0c198cde5 Waiting 9.3s
|
||||||
⠹ c8752d5b785c Waiting 9.3s
|
⠹ c8752d5b785c Waiting 9.3s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`docker compose pull` will try to pull image for services with a build section. If pull fails, it will let
|
||||||
|
user know this service image MUST be built. You can skip this by setting `--ignore-buildable` flag
|
||||||
|
|
|
@ -7,10 +7,20 @@ usage: docker compose pull [OPTIONS] [SERVICE...]
|
||||||
pname: docker compose
|
pname: docker compose
|
||||||
plink: docker_compose.yaml
|
plink: docker_compose.yaml
|
||||||
options:
|
options:
|
||||||
|
- option: ignore-buildable
|
||||||
|
value_type: bool
|
||||||
|
default_value: "false"
|
||||||
|
description: Ignore images that can be built.
|
||||||
|
deprecated: false
|
||||||
|
hidden: false
|
||||||
|
experimental: false
|
||||||
|
experimentalcli: false
|
||||||
|
kubernetes: false
|
||||||
|
swarm: false
|
||||||
- option: ignore-pull-failures
|
- option: ignore-pull-failures
|
||||||
value_type: bool
|
value_type: bool
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Pull what it can and ignores images with pull failures
|
description: Pull what it can and ignores images with pull failures.
|
||||||
deprecated: false
|
deprecated: false
|
||||||
hidden: false
|
hidden: false
|
||||||
experimental: false
|
experimental: false
|
||||||
|
@ -20,7 +30,7 @@ options:
|
||||||
- option: include-deps
|
- option: include-deps
|
||||||
value_type: bool
|
value_type: bool
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Also pull services declared as dependencies
|
description: Also pull services declared as dependencies.
|
||||||
deprecated: false
|
deprecated: false
|
||||||
hidden: false
|
hidden: false
|
||||||
experimental: false
|
experimental: false
|
||||||
|
@ -51,7 +61,7 @@ options:
|
||||||
shorthand: q
|
shorthand: q
|
||||||
value_type: bool
|
value_type: bool
|
||||||
default_value: "false"
|
default_value: "false"
|
||||||
description: Pull without printing progress information
|
description: Pull without printing progress information.
|
||||||
deprecated: false
|
deprecated: false
|
||||||
hidden: false
|
hidden: false
|
||||||
experimental: false
|
experimental: false
|
||||||
|
@ -99,6 +109,9 @@ examples: |-
|
||||||
⠹ 77a0c198cde5 Waiting 9.3s
|
⠹ 77a0c198cde5 Waiting 9.3s
|
||||||
⠹ c8752d5b785c Waiting 9.3s
|
⠹ c8752d5b785c Waiting 9.3s
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`docker compose pull` will try to pull image for services with a build section. If pull fails, it will let
|
||||||
|
user know this service image MUST be built. You can skip this by setting `--ignore-buildable` flag
|
||||||
deprecated: false
|
deprecated: false
|
||||||
experimental: false
|
experimental: false
|
||||||
experimentalcli: false
|
experimentalcli: false
|
||||||
|
|
|
@ -193,8 +193,9 @@ type PushOptions struct {
|
||||||
|
|
||||||
// PullOptions group options of the Pull API
|
// PullOptions group options of the Pull API
|
||||||
type PullOptions struct {
|
type PullOptions struct {
|
||||||
Quiet bool
|
Quiet bool
|
||||||
IgnoreFailures bool
|
IgnoreFailures bool
|
||||||
|
IgnoreBuildable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImagesOptions group options of the Images API
|
// ImagesOptions group options of the Images API
|
||||||
|
|
|
@ -102,6 +102,15 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if service.Build != nil && opts.IgnoreBuildable {
|
||||||
|
w.Event(progress.Event{
|
||||||
|
ID: service.Name,
|
||||||
|
Status: progress.Done,
|
||||||
|
Text: "Skipped - Image can be built",
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if s, ok := imagesBeingPulled[service.Image]; ok {
|
if s, ok := imagesBeingPulled[service.Image]; ok {
|
||||||
w.Event(progress.Event{
|
w.Event(progress.Event{
|
||||||
ID: service.Name,
|
ID: service.Name,
|
||||||
|
|
Loading…
Reference in New Issue