From 1fef59f738c83ee40ff401e68b0d30cedc2ba6a2 Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Fri, 8 Jan 2016 17:25:30 +0800 Subject: [PATCH] fresh image when receive commit event Signed-off-by: Xian Chaobo --- cluster/engine.go | 2 +- test/integration/api/images.bats | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cluster/engine.go b/cluster/engine.go index b62efa822d..9ac3986d76 100644 --- a/cluster/engine.go +++ b/cluster/engine.go @@ -773,7 +773,7 @@ func (e *Engine) String() string { func (e *Engine) handler(ev *dockerclient.Event, _ chan error, args ...interface{}) { // Something changed - refresh our internal state. switch ev.Status { - case "pull", "untag", "delete": + case "pull", "untag", "delete", "commit": // These events refer to images so there's no need to update // containers. e.RefreshImages() diff --git a/test/integration/api/images.bats b/test/integration/api/images.bats index ffddeab25e..c6b3120b52 100644 --- a/test/integration/api/images.bats +++ b/test/integration/api/images.bats @@ -68,3 +68,13 @@ function teardown() { [ "${#lines[@]}" -eq 2 ] [[ "${lines[1]}" == *"testimage"* ]] } + +@test "docker images - after commit on engine side" { + start_docker_with_busybox 2 + swarm_manage + + docker -H ${HOSTS[0]} run -d --name test_container busybox sleep 500 + docker -H ${HOSTS[0]} commit test_container testimage + + retry 5 1 eval "docker_swarm images | grep 'testimage'" +}