@@ -50,6 +50,7 @@ type configOptions struct {
50
50
noResolveEnv bool
51
51
services bool
52
52
volumes bool
53
+ networks bool
53
54
profiles bool
54
55
images bool
55
56
hash string
@@ -111,6 +112,9 @@ func configCommand(p *ProjectOptions, dockerCli command.Cli) *cobra.Command {
111
112
if opts .volumes {
112
113
return runVolumes (ctx , dockerCli , opts )
113
114
}
115
+ if opts .networks {
116
+ return runNetworks (ctx , dockerCli , opts )
117
+ }
114
118
if opts .hash != "" {
115
119
return runHash (ctx , dockerCli , opts )
116
120
}
@@ -147,6 +151,7 @@ func configCommand(p *ProjectOptions, dockerCli command.Cli) *cobra.Command {
147
151
148
152
flags .BoolVar (& opts .services , "services" , false , "Print the service names, one per line." )
149
153
flags .BoolVar (& opts .volumes , "volumes" , false , "Print the volume names, one per line." )
154
+ flags .BoolVar (& opts .networks , "networks" , false , "Print the network names, one per line." )
150
155
flags .BoolVar (& opts .profiles , "profiles" , false , "Print the profile names, one per line." )
151
156
flags .BoolVar (& opts .images , "images" , false , "Print the image names, one per line." )
152
157
flags .StringVar (& opts .hash , "hash" , "" , "Print the service config hash, one per line." )
@@ -367,6 +372,17 @@ func runVolumes(ctx context.Context, dockerCli command.Cli, opts configOptions)
367
372
return nil
368
373
}
369
374
375
+ func runNetworks (ctx context.Context , dockerCli command.Cli , opts configOptions ) error {
376
+ project , err := opts .ToProject (ctx , dockerCli , nil , cli .WithoutEnvironmentResolution )
377
+ if err != nil {
378
+ return err
379
+ }
380
+ for n := range project .Networks {
381
+ _ , _ = fmt .Fprintln (dockerCli .Out (), n )
382
+ }
383
+ return nil
384
+ }
385
+
370
386
func runHash (ctx context.Context , dockerCli command.Cli , opts configOptions ) error {
371
387
var services []string
372
388
if opts .hash != "*" {
0 commit comments