From 57d16bf9ed9677560c7bf57198ba998cc17084d4 Mon Sep 17 00:00:00 2001 From: timfeirg Date: Fri, 30 Sep 2016 12:52:01 +0800 Subject: [PATCH] remove image after build --- cluster/calcium/build_image.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cluster/calcium/build_image.go b/cluster/calcium/build_image.go index 768eaf37c..ad8932f8a 100644 --- a/cluster/calcium/build_image.go +++ b/cluster/calcium/build_image.go @@ -172,6 +172,7 @@ func (c *calcium) BuildImage(repository, version, uid, artifact string) (chan *t ForceRemove: true, PullParent: true, } + log.Infof("Building image %v at %v:%v", tag, buildPodname, node.Name) resp, err := node.Engine.ImageBuild(context.Background(), buildContext, buildOptions) if err != nil { return ch, err @@ -219,6 +220,12 @@ func (c *calcium) BuildImage(repository, version, uid, artifact string) (chan *t ch <- message } + rmiOpts := enginetypes.ImageRemoveOptions{ + Force: false, + PruneChildren: true, + } + go node.Engine.ImageRemove(context.Background(), tag, rmiOpts) + ch <- &types.BuildImageMessage{Status: "finished", Progress: tag} close(ch) }()