Skip to content

Commit

Permalink
Add helper scripts for the Docker experiments.
Browse files Browse the repository at this point in the history
  • Loading branch information
parazyd committed Oct 28, 2018
1 parent df4db3d commit 34fed72
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docker-sdk/docker-create.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions docker-sdk/docker-start.sh
Original file line number Diff line number Diff line change
@@ -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 changes: 12 additions & 0 deletions docker-sdk/docker-stop.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 34fed72

Please sign in to comment.