Last active
January 19, 2017 09:51
-
-
Save bse666/0cd27eff27e9c4b341eec725aae384e0 to your computer and use it in GitHub Desktop.
tinc-dockerstyle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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