mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #28128 from leth/commit_image_id
Add Image ID to container commit event
This commit is contained in:
commit
90d10203a4
1 changed files with 4 additions and 0 deletions
|
@ -226,6 +226,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageRef := ""
|
||||||
if c.Repo != "" {
|
if c.Repo != "" {
|
||||||
newTag, err := reference.WithName(c.Repo) // todo: should move this to API layer
|
newTag, err := reference.WithName(c.Repo) // todo: should move this to API layer
|
||||||
if err != nil {
|
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 {
|
if err := daemon.TagImageWithReference(id, newTag); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
imageRef = newTag.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
attributes := map[string]string{
|
attributes := map[string]string{
|
||||||
"comment": c.Comment,
|
"comment": c.Comment,
|
||||||
|
"imageID": id.String(),
|
||||||
|
"imageRef": imageRef,
|
||||||
}
|
}
|
||||||
daemon.LogContainerEventWithAttributes(container, "commit", attributes)
|
daemon.LogContainerEventWithAttributes(container, "commit", attributes)
|
||||||
containerActions.WithValues("commit").UpdateSince(start)
|
containerActions.WithValues("commit").UpdateSince(start)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue