From 36bf80e9a5608a0b372fe70d3319044c85fde714 Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Thu, 11 Nov 2021 18:53:36 +0000 Subject: [PATCH] Add a command to clean all datatracker related docker resources (from nick@staff.ietf.org) - Legacy-Id: 19644 --- docker/README.md | 20 +++++++++++++++++++- docker/cleanall | 7 +++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100755 docker/cleanall diff --git a/docker/README.md b/docker/README.md index 88e0f2546..bf98f49e9 100644 --- a/docker/README.md +++ b/docker/README.md @@ -121,7 +121,7 @@ docker-compose down to terminate the containers. -### Clean / Rebuild / Fetch Latest DB Image +### Clean and Rebuild DB from latest image To delete the active DB container, its volume and get the latest image / DB dump, simply run the following command: @@ -140,6 +140,24 @@ docker-compose pull db docker-compose build --no-cache db ``` +### Clean all + +To delete all containers for this project, its associated images and purge any remaining dangling images, simply run the following command: + +On Linux / macOS: + +```sh +cd docker +cleanall +``` + +On Windows: +```sh +cd docker +docker-compose down -v --rmi all +docker image prune +``` + ### Accessing MariaDB Port The port is exposed but not mapped to `3306` to avoid potential conflicts with the host. To get the mapped port, run the command *(from the project `/docker` directory)*: diff --git a/docker/cleanall b/docker/cleanall new file mode 100755 index 000000000..dd6f67669 --- /dev/null +++ b/docker/cleanall @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Shutting down any instance still running and purge images..." +docker-compose down -v --rmi all +echo "Purging dangling images..." +docker image prune +echo "Done!"