From 36b79a3ef300fb650d498e337d136dfc5178be0b Mon Sep 17 00:00:00 2001 From: Mars Lan Date: Thu, 17 Dec 2020 13:52:31 -0800 Subject: [PATCH] build(docker): add script to clean up docker environment (#2013) Co-authored-by: Mars Lan --- docker/nuke.sh | 8 ++++++++ docs/debugging.md | 12 ++---------- 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100755 docker/nuke.sh diff --git a/docker/nuke.sh b/docker/nuke.sh new file mode 100755 index 0000000000..859f51eacf --- /dev/null +++ b/docker/nuke.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd $DIR + +# Tear down and clean up all DataHub-related containers, volumes, and network +docker-compose -p datahub down -v +docker-compose rm -f -v diff --git a/docs/debugging.md b/docs/debugging.md index 48a193c91e..9a225b63c0 100644 --- a/docs/debugging.md +++ b/docs/debugging.md @@ -188,15 +188,7 @@ docker exec -i mysql sh -c 'exec mysql datahub -udatahub -pdatahub' < docker/mys ``` ## I've messed up my docker setup. How do I start from scratch? -1. Delete *all* docker containers, including ones that are created outside of the quickstart guide. +Run the following script to remove all the containers and volumes created during the quickstart tutorial. Note that you'll also lose all the data as a result. ``` -docker rm -f $(docker ps -aq) -``` -2. Drop all DataHub's docker volumes. -``` -docker volume rm -f $(docker volume ls -f name=datahub_ -q) -``` -3. Delete DataHub's network -``` -docker network rm datahub_network +./docker/nuke.sh ```