Skip to content

rwv/docker-zerotier-moon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-zerotier-moon

Docker Docker Version Docker Pulls Docker Image Size

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.

Table of Contents

Quickstart

Docker Run

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.4

Replace 1.2.3.4 with your moon's IPv4 address and replace ~/somewhere with where you would like to store ZeroTier state.

Docker Compose

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 -d

Show ZeroTier moon id

docker logs zerotier-moon

Or, if you started it with Docker Compose:

docker compose logs -f zerotier-moon

Advanced usage

Manage ZeroTier

docker exec zerotier-moon zerotier-cli

Mount ZeroTier conf folder

docker run --name zerotier-moon -d \
  -p 9993:9993/udp \
  -v ~/somewhere:/var/lib/zerotier-one \
  seedgou/zerotier-moon:latest \
  -4 1.2.3.4

When 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.

IPv6 support

docker run --name zerotier-moon -d \
  -p 9993:9993/udp \
  seedgou/zerotier-moon:latest \
  -4 1.2.3.4 \
  -6 2001:abcd:abcd::1

Replace 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.

Custom port

docker run --name zerotier-moon -d \
  -p 9994:9993/udp \
  seedgou/zerotier-moon:latest \
  -4 1.2.3.4 \
  -p 9994

Replace 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.

Network privilege

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.4

Solution 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.

Multi-arch support

This image supports linux/386, linux/amd64, linux/arm/v7, linux/arm64, linux/mips64le, linux/ppc64le, and linux/s390x.

GitHub Container Registry

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.

About

🐳 A docker image to create ZeroTier moon in one step.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors