Add Image ID & Ref to container commit event

Signed-off-by: Marcus Cobden <mcobden@cisco.com>
Upstream-commit: e60ae5380208c9329ef8be38fe3f4bdcd8ef6e83
Component: engine
This commit is contained in:
Marcus Cobden
2016-11-07 16:50:46 +00:00
parent 7b37b03f40
commit fa6bdfd965

View File

@ -226,6 +226,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
}
}
imageRef := ""
if c.Repo != "" {
newTag, err := reference.WithName(c.Repo) // todo: should move this to API layer
if err != nil {
@ -239,10 +240,13 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
if err := daemon.TagImageWithReference(id, newTag); err != nil {
return "", err
}
imageRef = newTag.String()
}
attributes := map[string]string{
"comment": c.Comment,
"imageID": id.String(),
"imageRef": imageRef,
}
daemon.LogContainerEventWithAttributes(container, "commit", attributes)
containerActions.WithValues("commit").UpdateSince(start)