A docker image to create a ZeroTier moon in one step.
This image now inherits ZeroTier from the official zerotier/zerotier base image instead of installing zerotier-one from Alpine packages.
Have a look at dockerized ZeroTier: rwv/zerotier.
docker run --name zerotier-moon -d --restart always \
-p 9993:9993/udp \
-v ~/somewhere:/var/lib/zerotier-one \
seedgou/zerotier-moon:latest \
-4 1.2.3.4Replace 1.2.3.4 with your moon's IPv4 address and replace ~/somewhere with where you would like to store ZeroTier state.
compose.yml example:
services:
zerotier-moon:
image: seedgou/zerotier-moon:latest
container_name: zerotier-moon
restart: unless-stopped
ports:
- "9993:9993/udp"
volumes:
- ./config:/var/lib/zerotier-one
command:
- "-4"
- "1.2.3.4"
- "-p"
- "9993"Replace 1.2.3.4 with your public IPv4 address and adjust ./config, image, or port mapping if needed.
Then start the container:
docker compose up -ddocker logs zerotier-moonOr, if you started it with Docker Compose:
docker compose logs -f zerotier-moondocker exec zerotier-moon zerotier-clidocker run --name zerotier-moon -d \
-p 9993:9993/udp \
-v ~/somewhere:/var/lib/zerotier-one \
seedgou/zerotier-moon:latest \
-4 1.2.3.4When creating a new container without mounting ZeroTier conf folder, a new moon id will be generated. This command will mount ~/somewhere to /var/lib/zerotier-one inside the container, allowing your ZeroTier moon to persist the same moon id. If you don't do this, when you start a new container, a new moon id will be generated.
docker run --name zerotier-moon -d \
-p 9993:9993/udp \
seedgou/zerotier-moon:latest \
-4 1.2.3.4 \
-6 2001:abcd:abcd::1Replace 1.2.3.4, 2001:abcd:abcd::1 with your moon's IP. You can remove -4 option in pure IPv6 environment.
For Docker Compose, add - "-6" and your IPv6 address under command in the example above.
docker run --name zerotier-moon -d \
-p 9994:9993/udp \
seedgou/zerotier-moon:latest \
-4 1.2.3.4 \
-p 9994Replace 9994 with your own custom port for ZeroTier moon.
If you use Docker Compose, update both the published port and the -p value in command.
If you encounter issue: ERROR: unable to configure virtual network port: could not open TUN/TAP device: No such file or directory, please add --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --device=/dev/net/tun args. Similar to this:
docker run --cap-add=NET_ADMIN --cap-add=SYS_ADMIN --device=/dev/net/tun \
--name zerotier-moon -d --restart always \
-p 9993:9993/udp \
seedgou/zerotier-moon:latest \
-4 1.2.3.4Solution provided by Jonnyan404's Fork.
See Also Issue #1.
If you use Docker Compose, add cap_add and devices to the service definition when your host requires TUN/TAP access.
This image supports linux/386, linux/amd64, linux/arm/v7, linux/arm64, linux/mips64le, linux/ppc64le, and linux/s390x.
This image is also published on GitHub Container Registry: ghcr.io/rwv/zerotier-moon
To use it with Docker Compose, replace image: seedgou/zerotier-moon:latest with image: ghcr.io/rwv/zerotier-moon:latest.