Skip to content

Instantly share code, notes, and snippets.

@bse666
Last active January 19, 2017 09:51
Show Gist options
  • Save bse666/0cd27eff27e9c4b341eec725aae384e0 to your computer and use it in GitHub Desktop.
Save bse666/0cd27eff27e9c4b341eec725aae384e0 to your computer and use it in GitHub Desktop.
tinc-dockerstyle
#!/bin/sh
# remove old container
docker rm -f tinc
# if no data available generate your keys
if [ ! -d "data" ]; then
mkdir data;
docker run -d \
--name tinc \
--net=host \
--device=/dev/net/tun \
--restart=always \
--cap-add NET_ADMIN \
--volume `pwd`/data:/etc/tinc \
tinc tincd --generate-keys=2048
# echo the next things to do here
exit
fi
# regulary start tinc
docker run -d \
--name tinc \
--net=host \
--device=/dev/net/tun \
--restart=always \
--cap-add NET_ADMIN \
--volume `pwd`/data:/etc/tinc \
tinc $1
FROM alpine
RUN set -xe && apk add -U tinc && rm -rf /var/cache/apk/*
EXPOSE 655/tcp 655/udp
VOLUME /etc/tinc
CMD tincd --no-detach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment