Skip to content

Commit 4d72b1e

Browse files
committed
fix: could not open TUN/TAP device: No such file or director
Signed-off-by: gythialy <gythialy.koo+github@gmail.com>
1 parent 0cbd15e commit 4d72b1e

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

Dockerfile

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
1-
FROM alpine:3.13 as builder
1+
FROM alpine:3.14
22

3-
ARG ZT_COMMIT=e8f7d5ef9e7ba6be0b2163cfa31f8817ba5b18f4
4-
5-
RUN apk add --update alpine-sdk linux-headers \
6-
&& git clone --quiet https://github.com/zerotier/ZeroTierOne.git /src \
7-
&& git -C src reset --quiet --hard ${ZT_COMMIT} \
8-
&& cd /src \
9-
&& make -f make-linux.mk
10-
11-
FROM alpine:3.13
123
LABEL version="1.6.5"
134
LABEL description="ZeroTier One moon as Docker Image"
145

15-
RUN apk add --update --no-cache libc6-compat libstdc++
6+
RUN apk add --no-cache zerotier-one=1.6.5-r0
167

8+
# ZeroTier relies on UDP port 9993
179
EXPOSE 9993/udp
1810

19-
COPY --from=builder /src/zerotier-one /usr/sbin/
20-
RUN mkdir -p /var/lib/zerotier-one \
21-
&& ln -s /usr/sbin/zerotier-one /usr/sbin/zerotier-idtool \
22-
&& ln -s /usr/sbin/zerotier-one /usr/sbin/zerotier-cli
23-
2411
COPY start-moon.sh /start-moon.sh
2512

2613
ENTRYPOINT ["/start-moon.sh"]

docker-compose.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
version: '3.5'
1+
version: "3.5"
22

33
services:
44
zerotier-moon:
55
image: gythialy/zerotier-one-moon:lastest
66
container_name: zerotier-moon
7+
cap_add:
8+
- NET_ADMIN
9+
- SYS_ADMIN
10+
devices:
11+
- /dev/net/tun
712
ports:
813
- 9993:9993/udp
914
command:

start-moon.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# borrowed from https://github.com/rwv/docker-zerotier-moon
44
# usage ./start-moon.sh -4 1.2.3.4 -6 2001:abcd:abcd::1 -p 9993
55

6+
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
7+
68
moon_port=9993 # default ZeroTier moon port
79

810
while getopts "4:6:p:" arg; do # handle args
@@ -43,7 +45,7 @@ else # ipv4 address is set
4345
fi
4446

4547
# trim whitespace
46-
stableEndpointsForSed="$(echo -e "${stableEndpointsForSed}" | tr -d '[:space:]')"
48+
stableEndpointsForSed="$(echo "${stableEndpointsForSed}" | tr -d '[:space:]')"
4749
echo "stableEndpoints: $stableEndpointsForSed"
4850

4951
if [ -d "/var/lib/zerotier-one/moons.d" ]; then # check if the moons conf has generated

0 commit comments

Comments
 (0)