Reputation: 857
I’ve got a lot of multibranch pipeline projects that use a same kind of Docker container. Is it possible to reuse that Docker container over multiple jobs? I want to do this to preserve storage space.
Upvotes: 0
Views: 1477
Reputation: 51768
This is not recommended, as you might get some unexpected side-effects from previous runs.
If you want to save space, make sure to clean up the containers once they exist using either --rm
option which removes the container once existing:
agent {
docker {
image ...
args '--rm'
}
}
or by running docker system prune --volumes -f
which will do a clean up of unused docker images and containers and volumes.
Upvotes: 1