diff --git a/graph.go b/graph.go index 26b6a9c662..e7044c25a0 100644 --- a/graph.go +++ b/graph.go @@ -85,9 +85,10 @@ func (graph *Graph) Get(name string) (*Image, error) { // Create creates a new image and registers it in the graph. func (graph *Graph) Create(layerData Archive, container *Container, comment string) (*Image, error) { img := &Image{ - Id: GenerateId(), - Comment: comment, - Created: time.Now(), + Id: GenerateId(), + Comment: comment, + Created: time.Now(), + DockerVersion: VERSION, } if container != nil { img.Parent = container.Image diff --git a/graph_test.go b/graph_test.go index 8ac8d10478..7c40330aa4 100644 --- a/graph_test.go +++ b/graph_test.go @@ -45,6 +45,9 @@ func TestGraphCreate(t *testing.T) { if image.Comment != "Testing" { t.Fatalf("Wrong comment: should be '%s', not '%s'", "Testing", image.Comment) } + if image.DockerVersion != VERSION { + t.Fatalf("Wrong docker_version: should be '%s', not '%s'", VERSION, image.DockerVersion) + } if images, err := graph.All(); err != nil { t.Fatal(err) } else if l := len(images); l != 1 { diff --git a/image.go b/image.go index 19e5387f97..83bf9481ae 100644 --- a/image.go +++ b/image.go @@ -20,6 +20,7 @@ type Image struct { Created time.Time `json:"created"` Container string `json:"container,omitempty"` ContainerConfig Config `json:"container_config,omitempty"` + DockerVersion string `json:"docker_version,omitempty"` graph *Graph }