From 0255a4cd616ef5466a862d50619f0ddd43bc0909 Mon Sep 17 00:00:00 2001 From: Drasko DRASKOVIC Date: Mon, 5 Feb 2018 02:33:51 +0100 Subject: [PATCH] Add `clean` function to docker-compose script Signed-off-by: Drasko DRASKOVIC --- bin/mainflux-docker.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/mainflux-docker.sh b/bin/mainflux-docker.sh index 1463bf9f..baa1bd37 100755 --- a/bin/mainflux-docker.sh +++ b/bin/mainflux-docker.sh @@ -150,7 +150,7 @@ _stop() { printf "\nStopping Nginx...\n\n" docker-compose -f docker/docker-compose.nginx.yml stop - printf "Stopping Mainflux composition...\n\n" + printf "\nStopping Mainflux composition...\n\n" docker-compose -f docker/docker-compose.mainflux.yml stop printf "\nStopping NATS and Cassandra...\n\n" @@ -159,6 +159,19 @@ _stop() { printf "\n*** MAINFLUX IS OFF ***\n\n" } +_clean() { + printf "\nCleaning NATS and Cassandra containers...\n\n" + docker-compose -f docker/docker-compose.infrastructure.yml rm -f + + printf "\nCleaning Mainflux containers...\n\n" + docker-compose -f docker/docker-compose.mainflux.yml rm -f + + printf "\nCleaning Nginx container...\n\n" + docker-compose -f docker/docker-compose.nginx.yml rm -f + + printf "\n*** Docker containers cleaned ***\n\n" +} + _mainflux_docker() { if [[ $1 == "start" ]] then @@ -166,6 +179,9 @@ _mainflux_docker() { elif [[ $1 == "stop" ]] then _stop + elif [[ $1 == "clean" ]] + then + _clean else printf "Unknown command.\n" fi