Preliminary commit of new files

This commit is contained in:
2014-12-18 12:12:17 +00:00
parent d6919960c0
commit 25a6f48597
63 changed files with 1004 additions and 0 deletions

4
bin/app Normal file
View File

@@ -0,0 +1,4 @@
DIR=`pwd`
cd /opt/docker/images/$1/
bin/app "$2"
cd $DIR

1
bin/attach Normal file
View File

@@ -0,0 +1 @@
lxc-attach -n `docker ps --no-trunc | grep $1: | cut -d' ' -f1`

4
bin/build Normal file
View File

@@ -0,0 +1,4 @@
DIR=`pwd`
cd /opt/docker/images/$1/
make build
cd $DIR

4
bin/clean Normal file
View File

@@ -0,0 +1,4 @@
IDS=`comm -3 <(docker ps -a -q | sort) <(docker ps -q | sort)`
if [[ ! -z "$IDS" ]]; then
docker rm $IDS
fi

1
bin/killall Normal file
View File

@@ -0,0 +1 @@
docker kill `docker ps -q`

4
bin/make Normal file
View File

@@ -0,0 +1,4 @@
DIR=`pwd`
cd /opt/docker/images/$1/
make $2
cd $DIR

1
bin/purge Normal file
View File

@@ -0,0 +1 @@
docker images | grep '<none>' | awk '{print $3}' | xargs docker rmi

31
bin/run Normal file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
# Arguments:
# $1 = redirected ? -t : <image>
# $2 = redirected ? <image> : <mode>
# $3 = redirected ? <options> : <command>
# When redirected:
# $4 = <mode>
# $5 = <command>
if [ -n "$1" ] && [ $1 == "-t" ]; then
HOST_ADDR=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'`
PARAMS="--rm -e HOST_ADDR=$HOST_ADDR $3 --name $2"
if [ -n "$4" ] && [ $4 == "-i" ]; then
# Run without services, provide shell
docker run $PARAMS -i -t $2 bash
elif [ -n "$4" ] && [ $4 == "-x" ]; then
# Run with services, provide shell
docker run $PARAMS -i -t $2 /opt/init -- bash -l
elif [ -n "$4" ] && [ $4 == "-c" ] && [ -n "$5" ]; then
# Run with services, provide shell
docker run $PARAMS -i -t $2 /opt/init -- $5
elif [ -n "$4" ] && [ $4 == "-w" ]; then
# Run without services
docker run $PARAMS $2
else
# Run with services
docker run $PARAMS $2 /opt/init
fi
else
/opt/docker/bin/clean # > /dev/null 2>&1
/opt/docker/images/$1/bin/run $2 $3
fi

4
bin/ssh Normal file
View File

@@ -0,0 +1,4 @@
DIR=`pwd`
cd /opt/docker/images/$1/
bin/ssh "$2" "$3"
cd $DIR

1
bin/stopall Normal file
View File

@@ -0,0 +1 @@
docker stop `docker ps -q`