1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-11-30 09:16:41 +02:00
dockerfiles/tinc/Dockerfile

40 lines
1019 B
Docker
Raw Normal View History

2015-06-14 05:06:12 +02:00
#
# Dockerfile for tinc
#
2015-06-22 15:12:35 +02:00
FROM alpine
2015-06-14 05:06:12 +02:00
MAINTAINER kev <noreply@datageek.inf>
ENV NETNAME netname
2015-06-14 06:01:04 +02:00
ENV PIDFILE /run/tinc.$NETNAME.pid
2015-06-14 05:48:08 +02:00
ENV VERBOSE 2
2015-06-14 10:34:04 +02:00
2015-06-14 05:48:08 +02:00
ENV ADDRESS 10.0.0.1
ENV NETMASK 255.255.255.0
2015-06-14 10:34:04 +02:00
ENV NETWORK 10.0.0.0/24
2015-06-14 05:06:12 +02:00
2015-06-22 15:12:35 +02:00
RUN apk add -U iptables tinc \
&& rm -rf /var/cache/apk/* \
2015-06-14 05:06:12 +02:00
&& mkdir -p /etc/tinc/$NETNAME/hosts
WORKDIR /etc/tinc/$NETNAME
2015-06-24 11:34:41 +02:00
RUN echo -e "Name=server\\nInterface=tun0" > tinc.conf \
2015-06-22 15:12:35 +02:00
&& echo -e "Subnet=$ADDRESS\\nSubnet=0.0.0.0/0" > hosts/server \
&& echo -e "\\n" | tincd -n $NETNAME -K4096 \
&& echo -e "ifconfig \$INTERFACE $ADDRESS netmask $NETMASK" > tinc-up \
&& echo -e "ifconfig \$INTERFACE down" > tinc-down \
2015-06-14 05:06:12 +02:00
&& chmod +x tinc-up tinc-down
VOLUME /etc/tinc
2015-06-14 10:34:04 +02:00
EXPOSE 655/tcp 655/udp
2015-06-14 09:15:04 +02:00
CMD mkdir -p /dev/net \
&& [ -e /dev/net/tun ] || mknod /dev/net/tun c 10 200 \
&& iptables -t nat -A POSTROUTING -s $NETWORK -o eth0 -j MASQUERADE \
&& tincd --no-detach \
--net $NETNAME \
--pidfile $PIDFILE \
--debug $VERBOSE
2015-06-14 05:48:08 +02:00