mirror of
https://github.com/docker/compose.git
synced 2025-07-29 08:34:15 +02:00
introduce docker compose config --images
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
9eb69465b7
commit
45956c36fb
@ -48,6 +48,7 @@ type convertOptions struct {
|
|||||||
services bool
|
services bool
|
||||||
volumes bool
|
volumes bool
|
||||||
profiles bool
|
profiles bool
|
||||||
|
images bool
|
||||||
hash string
|
hash string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +86,9 @@ func convertCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
|||||||
if opts.profiles {
|
if opts.profiles {
|
||||||
return runProfiles(opts, args)
|
return runProfiles(opts, args)
|
||||||
}
|
}
|
||||||
|
if opts.images {
|
||||||
|
return runConfigImages(opts, args)
|
||||||
|
}
|
||||||
|
|
||||||
return runConvert(ctx, backend, opts, args)
|
return runConvert(ctx, backend, opts, args)
|
||||||
}),
|
}),
|
||||||
@ -100,6 +104,7 @@ func convertCommand(p *projectOptions, backend api.Service) *cobra.Command {
|
|||||||
flags.BoolVar(&opts.services, "services", false, "Print the service names, one per line.")
|
flags.BoolVar(&opts.services, "services", false, "Print the service names, one per line.")
|
||||||
flags.BoolVar(&opts.volumes, "volumes", false, "Print the volume names, one per line.")
|
flags.BoolVar(&opts.volumes, "volumes", false, "Print the volume names, one per line.")
|
||||||
flags.BoolVar(&opts.profiles, "profiles", false, "Print the profile names, one per line.")
|
flags.BoolVar(&opts.profiles, "profiles", false, "Print the profile names, one per line.")
|
||||||
|
flags.BoolVar(&opts.images, "images", false, "Print the image names, one per line.")
|
||||||
flags.StringVar(&opts.hash, "hash", "", "Print the service config hash, one per line.")
|
flags.StringVar(&opts.hash, "hash", "", "Print the service config hash, one per line.")
|
||||||
flags.StringVarP(&opts.Output, "output", "o", "", "Save to file (default to stdout)")
|
flags.StringVarP(&opts.Output, "output", "o", "", "Save to file (default to stdout)")
|
||||||
|
|
||||||
@ -215,3 +220,18 @@ func runProfiles(opts convertOptions, services []string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func runConfigImages(opts convertOptions, services []string) error {
|
||||||
|
project, err := opts.toProject(services)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, s := range project.Services {
|
||||||
|
if s.Image != "" {
|
||||||
|
fmt.Println(s.Image)
|
||||||
|
} else {
|
||||||
|
fmt.Printf("%s_%s\n", project.Name, s.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user