Merge pull request #1981 from dokku/1220_mh-cleanup-dokku-label-containers

only remove containers with dokku label
This commit is contained in:
Jose Diaz-Gonzalez committed 2016-03-12 02:56:00 -05:00
commit 7704175f0d
2 files changed
+11 -2

No files matched your search

+2 -2
View File
@@ -414,11 +414,11 @@ docker_cleanup() {
declare desc="cleans up all exited/dead containers and removes all dangling images" declare desc="cleans up all exited/dead containers and removes all dangling images"
# delete all non-running containers # delete all non-running containers
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=exited' -q) &> /dev/null || true docker rm $(docker ps -a -f "status=exited" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true
# delete all dead containers # delete all dead containers
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docker rm $(docker ps -a -f 'status=dead' -q) &> /dev/null || true docker rm $(docker ps -a -f "status=dead" -f "label=$DOKKU_CONTAINER_LABEL" -q) &> /dev/null || true
# delete unused images # delete unused images
# shellcheck disable=SC2046 # shellcheck disable=SC2046
+9
View File
@@ -40,16 +40,25 @@ build_nginx_config() {
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
RANDOM_RUN_CID="$(docker run -d gliderlabs/herokuish bash)"
docker ps -a
run dokku cleanup run dokku cleanup
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_success assert_success
sleep 5 # wait for dokku cleanup to happen in the background sleep 5 # wait for dokku cleanup to happen in the background
docker ps -a
run bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\"" run bash -c "docker ps -a -f 'status=exited' --no-trunc=true | grep \"/exec echo $TEST_APP\""
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_failure
run bash -c "docker inspect $RANDOM_RUN_CID"
echo "output: "$output
echo "status: "$status
assert_success
} }
@test "(core) run (with DOKKU_RM_CONTAINER/--rm-container)" { @test "(core) run (with DOKKU_RM_CONTAINER/--rm-container)" {