From f0a9ad9cf567991983e2dac271700d7f71ae6d08 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Sun, 10 Apr 2016 20:18:39 -0700 Subject: [PATCH] Add run script. This script allows you to launch several images from this repository once they're built. Make sure you add the `docker run` command in the header of the Dockerfile so the script can find it and execute it. Use pulseaudio/Dockerfile and skype/Dockerfile as examples. Signed-off-by: David Calavera --- run.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 run.sh diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..9fe156e --- /dev/null +++ b/run.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# This script allows you to launch several images +# from this repository once they're built. +# +# Make sure you add the `docker run` command +# in the header of the Dockerfile so the script +# can find it and execute it. +# +# Use pulseaudio/Dockerfile and skype/Dockerfile as examples. + +if [ $# -eq 0 ]; then + echo "Usage: $0 [--test] image1 image2 ..." + exit 1 +fi + +if [ "$1" = "--test" ]; then + TEST=1 + shift +fi + +for name in "$@"; do + if [ ! -d $name ]; then + echo "unable to find container configuration with name $name" + exit 1 + fi + + script=`sed -n '/docker run/,/^#$/p' $name/Dockerfile | head -n -1 | sed -e 's/\#//' | sed -e 's/\\\//'` + + if [ $TEST ]; then + echo $script + else + eval $script + fi + + shift +done