drone-plugins/drone-docker

Execute system prune and rmi in cleanup

Opened this issue · 1 comments

SeJunB commented

Hello,

My team is currently using the plugins/ecr, and I noticed that the commands docker rmi and docker system prune -f are printed in the logs, but these commands are never executed; we are mounting the host machine's docker daemon. Looking at the code, thedocker rmi and docker system prune -f commands are printed out using the trace function but is never executed. This PR fixes this.

Related issue #378.

SeJunB commented

I recommend only removing the images and not executing the docker system prune -f in the cleanup stage, as running this command can interfere with concurrent builds that share the host's Docker daemon.

Scenario
Consider two pipelines: Pipeline A and Pipeline B that are running in parallel. If Pipeline A executes docker system prune -f just as Pipeline B is about to start a step that uses the host machine's Docker daemon, the prune command could remove resources the network that Pipeline B relies on. This will lead to a failure in Pipeline B's execution.