From 661ee5d652475e6be6812f80156495d778d64173 Mon Sep 17 00:00:00 2001 From: Jacob McCann Date: Tue, 14 Mar 2017 16:14:48 -0500 Subject: [PATCH] Remove unused docker data --- plugin.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/plugin.go b/plugin.go index f65921a..c0e97ee 100644 --- a/plugin.go +++ b/plugin.go @@ -63,17 +63,6 @@ type ( // Exec executes the plugin step func (p Plugin) Exec() error { - - // TODO execute code remove dangling images - // this is problematic because we are running docker in scratch which does - // not have bash, so we need to hack something together - // docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi - - /* - cmd = exec.Command("docker", "images", "-q", "-f", "dangling=true") - cmd = exec.Command("docker", append([]string{"rmi"}, images...)...) - */ - // start the Docker daemon server if !p.Daemon.Disabled { cmd := commandDaemon(p.Daemon) @@ -123,6 +112,7 @@ func (p Plugin) Exec() error { var cmds []*exec.Cmd cmds = append(cmds, commandVersion()) // docker version cmds = append(cmds, commandInfo()) // docker info + cmds = append(cmds, commandDockerPrune()) // cleanup docker cmds = append(cmds, commandBuild(p.Build)) // docker build for _, tag := range p.Build.Tags { @@ -301,6 +291,10 @@ func commandDaemon(daemon Daemon) *exec.Cmd { return exec.Command(dockerdExe, args...) } +func commandDockerPrune() *exec.Cmd { + return exec.Command(dockerExe, "system", "prune", "-f") +} + // trace writes each command to stdout with the command wrapped in an xml // tag so that it can be extracted and displayed in the logs. func trace(cmd *exec.Cmd) {