mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-01-12 04:23:04 +02:00
add tinc(alpine)
This commit is contained in:
parent
def7918e9b
commit
7bf5408f79
@ -2,7 +2,7 @@
|
|||||||
# Dockerfile for tinc
|
# Dockerfile for tinc
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM debian:jessie
|
FROM alpine
|
||||||
MAINTAINER kev <noreply@datageek.inf>
|
MAINTAINER kev <noreply@datageek.inf>
|
||||||
|
|
||||||
ENV NETNAME netname
|
ENV NETNAME netname
|
||||||
@ -13,18 +13,17 @@ ENV ADDRESS 10.0.0.1
|
|||||||
ENV NETMASK 255.255.255.0
|
ENV NETMASK 255.255.255.0
|
||||||
ENV NETWORK 10.0.0.0/24
|
ENV NETWORK 10.0.0.0/24
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apk add -U iptables tinc \
|
||||||
&& apt-get install -y iptables net-tools tinc \
|
&& rm -rf /var/cache/apk/* \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& mkdir -p /etc/tinc/$NETNAME/hosts
|
&& mkdir -p /etc/tinc/$NETNAME/hosts
|
||||||
|
|
||||||
WORKDIR /etc/tinc/$NETNAME
|
WORKDIR /etc/tinc/$NETNAME
|
||||||
|
|
||||||
RUN /bin/echo -e "Name=server\\nAddressFamily=ipv4\\nInterface=tun0" > tinc.conf \
|
RUN echo -e "Name=server\\nAddressFamily=ipv4\\nInterface=tun0" > tinc.conf \
|
||||||
&& /bin/echo -e "Subnet=$ADDRESS\\nSubnet=0.0.0.0/0" > hosts/server \
|
&& echo -e "Subnet=$ADDRESS\\nSubnet=0.0.0.0/0" > hosts/server \
|
||||||
&& /bin/echo -e "\\n" | tincd -n $NETNAME -K4096 \
|
&& echo -e "\\n" | tincd -n $NETNAME -K4096 \
|
||||||
&& /bin/echo -e "ifconfig \$INTERFACE $ADDRESS netmask $NETMASK" > tinc-up \
|
&& echo -e "ifconfig \$INTERFACE $ADDRESS netmask $NETMASK" > tinc-up \
|
||||||
&& /bin/echo -e "ifconfig \$INTERFACE down" > tinc-down \
|
&& echo -e "ifconfig \$INTERFACE down" > tinc-down \
|
||||||
&& chmod +x tinc-up tinc-down
|
&& chmod +x tinc-up tinc-down
|
||||||
|
|
||||||
VOLUME /etc/tinc
|
VOLUME /etc/tinc
|
||||||
|
40
tinc/Dockerfile.debian
Normal file
40
tinc/Dockerfile.debian
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Dockerfile for tinc
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM debian:jessie
|
||||||
|
MAINTAINER kev <noreply@datageek.inf>
|
||||||
|
|
||||||
|
ENV NETNAME netname
|
||||||
|
ENV PIDFILE /run/tinc.$NETNAME.pid
|
||||||
|
ENV VERBOSE 2
|
||||||
|
|
||||||
|
ENV ADDRESS 10.0.0.1
|
||||||
|
ENV NETMASK 255.255.255.0
|
||||||
|
ENV NETWORK 10.0.0.0/24
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iptables net-tools tinc \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& mkdir -p /etc/tinc/$NETNAME/hosts
|
||||||
|
|
||||||
|
WORKDIR /etc/tinc/$NETNAME
|
||||||
|
|
||||||
|
RUN /bin/echo -e "Name=server\\nAddressFamily=ipv4\\nInterface=tun0" > tinc.conf \
|
||||||
|
&& /bin/echo -e "Subnet=$ADDRESS\\nSubnet=0.0.0.0/0" > hosts/server \
|
||||||
|
&& /bin/echo -e "\\n" | tincd -n $NETNAME -K4096 \
|
||||||
|
&& /bin/echo -e "ifconfig \$INTERFACE $ADDRESS netmask $NETMASK" > tinc-up \
|
||||||
|
&& /bin/echo -e "ifconfig \$INTERFACE down" > tinc-down \
|
||||||
|
&& chmod +x tinc-up tinc-down
|
||||||
|
|
||||||
|
VOLUME /etc/tinc
|
||||||
|
EXPOSE 655/tcp 655/udp
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user