#!/bin/bash set -euo pipefail timeout 1m docker pull circleci/docker-gc:1.0 docker rm -f docker-gc || true # Will return exit 0 if volume already exists docker volume create docker-gc --label=keep # --net=host is used to allow the container to talk to the local statsd agent docker run \ --rm \ --interactive \ --name "docker-gc" \ --privileged \ --net=host \ --userns=host \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume /var/lib/docker:/var/lib/docker:ro \ --volume docker-gc:/state \ "circleci/docker-gc:1.0" \ -threshold "1000 KB"