Do not delete containers with the label dokku.service

[ci skip]
This commit is contained in:
Jose Diaz-Gonzalez
2015-09-08 11:21:38 -04:00
committed by Jose Diaz-Gonzalez
parent c9bca838f0
commit 92497cf095

View File

@@ -323,8 +323,13 @@ release_and_deploy() {
docker_cleanup() {
# delete all non-running containers
# if a container has the label `dokku.service`,
# then that container is not deleted.
# This can be used to mark data containers
# as non-removable by the cleanup function
# shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true
docker rm $(comm <(docker ps -aq -f 'status=exited' | sort) <(docker ps -aq -f 'status=exited' -f 'label=dokku.service' | sort) -3) &> /dev/null || true
# delete unused images
# shellcheck disable=SC2046
docker rmi $(docker images -f 'dangling=true' -q) &> /dev/null &