launch-docker-test-daemon 830 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
#!/bin/bash

die()
{
	echo "error: $@" >&2
	exit 1
}

set -e

BAIRE Anthony's avatar
BAIRE Anthony committed
11
vol="`pwd`/data/controller"
12
vol="`realpath "$vol"`"
13 14 15 16 17 18 19 20 21 22 23

. prepare.sh


[ -d "$vol" ] || die "directory $vol not present"


dir="$vol/test-daemon"
pidfile="$dir/docker.pid"
sock="$dir/docker.sock"
graph="$dir/graph"
24
run="$dir/run"
25 26 27 28 29 30 31 32 33 34 35 36

[ -d "$dir" ] || mkdir "$dir"


mountpoint="`stat -c %m "$dir"`"

if [ "`realpath "$mountpoint"`" != "`realpath "$dir"`" ] 
then
	echo "mounting tmpfs dir"
	sudo mount -t tmpfs tmpfs-docker "$dir"
fi

37
export DOCKER_HOST="unix://$sock"
38 39 40

echo "export DOCKER_HOST='$DOCKER_HOST'"

41 42 43 44 45 46 47 48 49 50 51 52
create_network()
{
	sleep 2
	net=allgo_sandboxes
	echo "create network $net"
	docker network create "$net"
	exit 0
}

create_network &

exec sudo dockerd \
53
	--exec-root "$run"	\
54 55 56
	--graph "$graph"	\
	--host  "$DOCKER_HOST"	\
	--pidfile "$pidfile"	\
57
	-s overlay2
58