Add helper scripts for the Docker experiments.

This commit is contained in:
parazyd 2018-10-28 12:26:06 +01:00
parent df4db3d9b6
commit 34fed726dd
No known key found for this signature in database
GPG Key ID: F0CB28FCF78637DE
3 changed files with 48 additions and 0 deletions

27
docker-sdk/docker-create.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
#
# This script will run the keygen script for a requested amount of times.
# It takes an optional integer parameter - amount - for the amount of dockers.
# Otherwise it will default to 5.
usage() {
echo "$(basename $0) [number]"
exit 1
}
[ -z "$1" ] && AMOUNT=5
case "$1" in
*[!0-9]*)
usage
;;
*)
AMOUNT="$1"
;;
esac
rm -f onions.txt
for i in $(seq 1 $AMOUNT); do
./keygen
done

9
docker-sdk/docker-start.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
#
# This script will start containers that were generated with create.sh
for i in $(cat onions.txt); do
onion="$(echo $i | cut -d':' -f2)"
container="$(docker run -d dyne/decodeos:$onion)"
echo "Started container $container for $onion"
done

12
docker-sdk/docker-stop.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
#
# This script will stop and delete the created containers and images.
containers="$(docker container ls | awk '/dyne\/decodeos:.*\.onion/ {print $1}')"
echo "$containers" | xargs docker stop
echo "$containers" | xargs docker rm
images="$(docker images | awk '/dyne\/decodeos:.*\.onion/ {print $3}')"
echo "$images" | xargs docker rmi