Blame SOURCES/docker-cleanup.sh

638b7f
#!/bin/bash
638b7f
638b7f
# Do nothing if neither docker nor docker-latest service is running
638b7f
if ! systemctl --quiet is-active docker-latest && ! systemctl --quiet is-active docker; then
638b7f
  exit 0
638b7f
fi
638b7f
638b7f
# If there are no dead containers, exit.
638b7f
DEAD_CONTAINERS=`docker ps -aq -f status=dead`
638b7f
638b7f
[ -z "$DEAD_CONTAINERS" ] && exit 0
638b7f
638b7f
# Try to cleanup dead containers
638b7f
docker rm $DEAD_CONTAINERS