demo_ansible/roles/docker/files/docker-prune.sh

11 lines
391 B
Bash
Raw Normal View History

2021-04-04 16:45:11 +00:00
#!/bin/sh
# prune *all* images not currently used
docker image prune -af
# prune unused volumes (we keep all state host-mounts)
docker volume prune -f
# prune images, containers, networks etc. but keep potentially used one (no -a)
docker system prune -f
# update left-over images
docker images | grep -v "^REPO" | grep -v "^<none>" | sed 's/ \+/:/g' | cut -d: -f1,2 | xargs -L1 docker pull