Browse code

An image embeds the configuration of its parent container ('ContainerConfig')

Solomon Hykes authored on 2013/03/24 06:48:16
Showing 3 changed files
... ...
@@ -311,7 +311,7 @@ func (srv *Server) CmdHistory(stdin io.ReadCloser, stdout io.Writer, args ...str
311 311
 		fmt.Fprintf(w, "%s\t%s\t%s\n",
312 312
 			srv.runtime.repositories.ImageName(img.Id),
313 313
 			HumanDuration(time.Now().Sub(img.Created))+" ago",
314
-			strings.Join(img.ParentCommand, " "),
314
+			strings.Join(img.ContainerConfig.Cmd, " "),
315 315
 		)
316 316
 		return nil
317 317
 	})
... ...
@@ -55,8 +55,8 @@ func (graph *Graph) Create(layerData Archive, container *Container, comment stri
55 55
 	}
56 56
 	if container != nil {
57 57
 		img.Parent = container.Image
58
-		img.ParentContainer = container.Id
59
-		img.ParentCommand = append([]string{container.Path}, container.Args...)
58
+		img.Container = container.Id
59
+		img.ContainerConfig = *container.Config
60 60
 	}
61 61
 	if err := graph.Register(layerData, img); err != nil {
62 62
 		return nil, err
... ...
@@ -19,8 +19,8 @@ type Image struct {
19 19
 	Parent          string    `json:"parent,omitempty"`
20 20
 	Comment         string    `json:"comment,omitempty"`
21 21
 	Created         time.Time `json:"created"`
22
-	ParentContainer string    `json:"parent_container,omitempty"`
23
-	ParentCommand   []string  `json:"parent_command,omitempty"`
22
+	Container       string    `json:"container,omitempty"`
23
+	ContainerConfig Config    `json:"container_config,omitempty"`
24 24
 	graph           *Graph
25 25
 }
26 26