0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-09 17:20:39 +00:00

Merge pull request #115 from jmccann/clean_system

Remove unused docker data
This commit is contained in:
Brad Rydzewski 2017-03-15 08:20:18 +08:00 committed by GitHub
commit 7d41e1efe4

View File

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