Browse code

Merge pull request #28128 from leth/commit_image_id

Add Image ID to container commit event

Victor Vieux authored on 2016/11/11 16:14:46
Showing 1 changed files
... ...
@@ -226,6 +226,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
226 226
 		}
227 227
 	}
228 228
 
229
+	imageRef := ""
229 230
 	if c.Repo != "" {
230 231
 		newTag, err := reference.WithName(c.Repo) // todo: should move this to API layer
231 232
 		if err != nil {
... ...
@@ -239,10 +240,13 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
239 239
 		if err := daemon.TagImageWithReference(id, newTag); err != nil {
240 240
 			return "", err
241 241
 		}
242
+		imageRef = newTag.String()
242 243
 	}
243 244
 
244 245
 	attributes := map[string]string{
245 246
 		"comment": c.Comment,
247
+		"imageID": id.String(),
248
+		"imageRef": imageRef,
246 249
 	}
247 250
 	daemon.LogContainerEventWithAttributes(container, "commit", attributes)
248 251
 	containerActions.WithValues("commit").UpdateSince(start)