@@ -79,27 +79,38 @@ func getMetadataList(image pkgutil.Image) ([]string, error) {
7979 return nil , err
8080 }
8181 c := configFile .Config
82+
8283 return []string {
8384 fmt .Sprintf ("Domainname: %s" , c .Domainname ),
8485 fmt .Sprintf ("User: %s" , c .User ),
8586 fmt .Sprintf ("AttachStdin: %t" , c .AttachStdin ),
8687 fmt .Sprintf ("AttachStdout: %t" , c .AttachStdout ),
8788 fmt .Sprintf ("AttachStderr: %t" , c .AttachStderr ),
88- fmt .Sprintf ("ExposedPorts: %v" , pkgutil .SortMap (c .ExposedPorts )),
89+ fmt .Sprintf ("ExposedPorts: %v" , pkgutil .SortMap (StructMapToStringMap ( c .ExposedPorts ) )),
8990 fmt .Sprintf ("Tty: %t" , c .Tty ),
9091 fmt .Sprintf ("OpenStdin: %t" , c .OpenStdin ),
9192 fmt .Sprintf ("StdinOnce: %t" , c .StdinOnce ),
9293 fmt .Sprintf ("Env: %s" , strings .Join (c .Env , "," )),
9394 fmt .Sprintf ("Cmd: %s" , strings .Join (c .Cmd , "," )),
9495 fmt .Sprintf ("ArgsEscaped: %t" , c .ArgsEscaped ),
95- fmt .Sprintf ("Volumes: %v" , pkgutil .SortMap (c .Volumes )),
96+ fmt .Sprintf ("Volumes: %v" , pkgutil .SortMap (StructMapToStringMap ( c .Volumes ) )),
9697 fmt .Sprintf ("Workdir: %s" , c .WorkingDir ),
9798 fmt .Sprintf ("Entrypoint: %s" , strings .Join (c .Entrypoint , "," )),
9899 fmt .Sprintf ("NetworkDisabled: %t" , c .NetworkDisabled ),
99100 fmt .Sprintf ("MacAddress: %s" , c .MacAddress ),
100101 fmt .Sprintf ("OnBuild: %s" , strings .Join (c .OnBuild , "," )),
101- fmt .Sprintf ("Labels: %v" , c .Labels ),
102+ fmt .Sprintf ("Labels: %v" , pkgutil . SortMap ( c .Labels ) ),
102103 fmt .Sprintf ("StopSignal: %s" , c .StopSignal ),
103104 fmt .Sprintf ("Shell: %s" , strings .Join (c .Shell , "," )),
104105 }, nil
105106}
107+
108+ // StructMapToStringMap converts map[string]struct{} to map[string]string knowing that the
109+ // struct in the value is always empty
110+ func StructMapToStringMap (m map [string ]struct {}) map [string ]string {
111+ newMap := make (map [string ]string )
112+ for k := range m {
113+ newMap [k ] = fmt .Sprintf ("%s" , m [k ])
114+ }
115+ return newMap
116+ }
0 commit comments