Created
September 4, 2019 15:39
-
-
Save Role911/1d7e1f22f48c3a71f12018bae49d3ccb to your computer and use it in GitHub Desktop.
start network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright IBM Corp All Rights Reserved | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
# Remove unwanted docker containers | |
function dkcl(){ | |
CONTAINER_IDS=$(docker ps -aq) | |
echo | |
if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then | |
echo "========== No containers available for deletion ==========" | |
else | |
docker rm -f $CONTAINER_IDS | |
fi | |
echo | |
} | |
# Remove unwanted docker images | |
function dkrm(){ | |
DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}') | |
echo | |
if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" = " " ]; then | |
echo "========== No images available for deletion ===========" | |
else | |
docker rmi -f $DOCKER_IMAGE_IDS | |
fi | |
echo | |
} | |
# Restart network. | |
function restartNetwork() { | |
echo | |
#teardown the network and clean the containers and intermediate images | |
docker-compose -f ./docker-compose.yaml down | |
dkcl | |
dkrm | |
#Cleanup the stores | |
rm -rf ./wallet | |
#Start the network | |
docker-compose -f ./docker-compose.yaml up -d | |
echo | |
} | |
restartNetwork |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment