소스 검색

Add Image ID & Ref to container commit event

Signed-off-by: Marcus Cobden <mcobden@cisco.com>
Marcus Cobden 8 년 전
부모
커밋
e60ae53802
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      daemon/commit.go

+ 4 - 0
daemon/commit.go

@@ -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)