diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-09 10:14:20 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-09 10:14:20 -0700 |
| commit | c2bbec2f050da996f660f2ae28b365330ebff633 (patch) | |
| tree | 2e4035e44637631c6034a7756ac917fc5d17ae79 /examples/docker/main.sh | |
| parent | 0c498556d5b11c101d2b18cf85cff2d53aa97d58 (diff) | |
| download | infinitytier-c2bbec2f050da996f660f2ae28b365330ebff633.tar.gz infinitytier-c2bbec2f050da996f660f2ae28b365330ebff633.zip | |
Docker example (and useful for testing)
Diffstat (limited to 'examples/docker/main.sh')
| -rw-r--r-- | examples/docker/main.sh | 25 |
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..e9febb13 --- /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" >identity.secret + +/var/lib/zerotier-one/zerotier-one |
