fresh image when receive commit event

Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
Xian Chaobo 2016-01-08 17:25:30 +08:00
parent 3aa302d706
commit 1fef59f738
2 changed files with 11 additions and 1 deletions

View File

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

View File

@ -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'"
}