@@ -34,28 +34,46 @@ func Inspect(out io.Writer, app *types.App, argParameters map[string]string, ima
3434
3535 // Add Service section
3636 printSection (out , len (config .Services ), func (w io.Writer ) {
37+ sort .Slice (config .Services , func (i , j int ) bool {
38+ return config .Services [i ].Name < config .Services [j ].Name
39+ })
3740 for _ , service := range config .Services {
3841 fmt .Fprintf (w , "%s\t %d\t %s\t %s\n " , service .Name , getReplicas (service ), getPorts (service .Ports ), service .Image )
3942 }
4043 }, "Service" , "Replicas" , "Ports" , "Image" )
4144
4245 // Add Network section
4346 printSection (out , len (config .Networks ), func (w io.Writer ) {
47+ names := make ([]string , 0 , len (config .Networks ))
4448 for name := range config .Networks {
49+ names = append (names , name )
50+ }
51+ sort .Strings (names )
52+ for _ , name := range names {
4553 fmt .Fprintln (w , name )
4654 }
4755 }, "Network" )
4856
4957 // Add Volume section
5058 printSection (out , len (config .Volumes ), func (w io.Writer ) {
59+ names := make ([]string , 0 , len (config .Volumes ))
5160 for name := range config .Volumes {
61+ names = append (names , name )
62+ }
63+ sort .Strings (names )
64+ for _ , name := range names {
5265 fmt .Fprintln (w , name )
5366 }
5467 }, "Volume" )
5568
5669 // Add Secret section
5770 printSection (out , len (config .Secrets ), func (w io.Writer ) {
71+ names := make ([]string , 0 , len (config .Secrets ))
5872 for name := range config .Secrets {
73+ names = append (names , name )
74+ }
75+ sort .Strings (names )
76+ for _ , name := range names {
5977 fmt .Fprintln (w , name )
6078 }
6179 }, "Secret" )
0 commit comments