| #!/bin/bash |
| |
| DOCKER_ORG="apache" |
| |
| # These are the images that are currently being used, so don't `docker rmi` them on cleanup. |
| KEEP_IMAGES=( |
| couchdbci-debian:bullseye-erlang-25.3 |
| couchdbci-debian:bullseye-erlang-24.3.4.10 |
| couchdbci-debian:bullseye-erlang-23.3.4.18 |
| couchdbci-debian:buster-erlang-24.3.4.10 |
| couchdbci-debian:buster-erlang-23.3.4.18 |
| couchdbci-centos:8-erlang-24.3.4.10 |
| couchdbci-centos:7-erlang-24.3.4.10 |
| couchdbci-ubuntu:jammy-erlang-24.3.4.10 |
| couchdbci-ubuntu:focal-erlang-24.3.4.10 |
| couchdbci-ubuntu:focal-erlang-23.3.4.18 |
| couchdbci-ubuntu:bionic-erlang-24.3.4.10 |
| couchdbci-ubuntu:bionic-erlang-23.3.4.18 |
| ) |
| |
| for image in ${KEEP_IMAGES[*]} |
| do |
| echo docker pull ${DOCKER_ORG}/${image} |
| docker pull ${DOCKER_ORG}/${image} |
| # We don't want to delete the current working set of images. |
| if ! printf '%s\n' "${KEEP_IMAGES[@]}" | grep -q -P "^${image}$"; then |
| echo docker rmi ${DOCKER_ORG}/$image |
| docker rmi ${DOCKER_ORG}/$image |
| fi |
| done |
| |
| docker system prune -f |