Expected Outcome
Dangling Docker containers and volumes are automatically pruned daily, helping to promote a healthy OverlayFS performance.
Prerequisites
- Linux System with
crond
service enabled - Root access
Procedure
- SSH into the Terraform Enterprise host and switch to the
root
user.
# Run as root
cat > /etc/cron.daily/docker-prune << EOF
#!/bin/bash
echo "Pruning dangling Docker containers"
docker container prune -f
echo "Pruning dangling Docker volumes"
docker volume prune -f
> EOF - Make the file executable.
# Enable executable bit
chmod +x /etc/cron.daily/docker-prune - Confirm the script will run as expected.
run-parts /etc/cron.daily
# Example output
/etc/cron.daily/docker-prune:
Pruning dangling Docker containers
Total reclaimed space: 0B
Pruning dangling Docker volumes
Total reclaimed space: 0B