summaryrefslogtreecommitdiff
path: root/examples/docker/main.sh
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-23 10:46:52 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-11-23 10:46:52 -0800
commita18336fa1899a9f53b161a60e766695007c49a7b (patch)
treef464c0475ea49e3714df86d69508644adcf2e98a /examples/docker/main.sh
parent1e4a40e77205b028d799f7112127f3f2f107117e (diff)
parent764dd1c3d94527c0870a913ac314b3b17eaea282 (diff)
downloadinfinitytier-a18336fa1899a9f53b161a60e766695007c49a7b.tar.gz
infinitytier-a18336fa1899a9f53b161a60e766695007c49a7b.zip
MERGE current "dev" into "netcon" -- should not affect netcon itself but will retest -- brings ZeroTier core up to 1.1.0
Diffstat (limited to 'examples/docker/main.sh')
-rw-r--r--examples/docker/main.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/docker/main.sh b/examples/docker/main.sh
new file mode 100644
index 00000000..53fb6540
--- /dev/null
+++ b/examples/docker/main.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
+
+if [ ! -c "/dev/net/tun" ]; then
+ echo 'FATAL: must be docker run with: --device=/dev/net/tun --cap-add=NET_ADMIN'
+ exit 1
+fi
+
+if [ -z "$ZEROTIER_IDENTITY_SECRET" ]; then
+ echo 'FATAL: ZEROTIER_IDENTITY_SECRET not set -- aborting!'
+ exit 1
+fi
+
+if [ -z "$ZEROTIER_NETWORK" ]; then
+ echo 'Warning: ZEROTIER_NETWORK not set, you will need to docker exec zerotier-cli to join a network.'
+else
+ # The existence of a .conf will cause the service to "remember" this network
+ touch /var/lib/zerotier-one/networks.d/$ZEROTIER_NETWORK.conf
+fi
+
+rm -f /var/lib/zerotier-one/identity.*
+echo "$ZEROTIER_IDENTITY_SECRET" >/var/lib/zerotier-one/identity.secret
+
+/var/lib/zerotier-one/zerotier-one