https://github.com/wxx9248/docker-zerotier-moon
Dockerized ZeroTier moon server
https://github.com/wxx9248/docker-zerotier-moon
docker zerotier zerotier-moon
Last synced: 3 months ago
JSON representation
Dockerized ZeroTier moon server
- Host: GitHub
- URL: https://github.com/wxx9248/docker-zerotier-moon
- Owner: wxx9248
- License: gpl-3.0
- Created: 2023-08-06T16:07:41.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-03-14T20:37:45.000Z (7 months ago)
- Last Synced: 2025-04-02T07:11:33.909Z (7 months ago)
- Topics: docker, zerotier, zerotier-moon
- Language: Python
- Homepage:
- Size: 142 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Credits
* [rwv/docker-zerotier-moon](https://github.com/rwv/docker-zerotier-moon)
* [zerotier/zerotier](https://github.com/zerotier/ZeroTierOne)## What's different?
* Changed based image to `zerotier-zerotier`.
* Alpine seemed to drop support for ZeroTier in the latest branch,
as for now, [v3.18](https://pkgs.alpinelinux.org/packages?name=zerotier-one&branch=v3.18),
so I decided to create a moon server image from the official ZeroTier image,
which is bigger (based on Debian) but is guaranteed to keep up with the latest ZeroTier release.
* Re-wrote `entrypoint` file with Python
* There is a reference to the Bash implementation in rwv's repository.
* I just don't want to replace JSON fields with `sed` - it can get messy.
* Moons can join networks now
* I kept the feature from the official image.
* With a few environment variables, you can specify the identity of the moon server,
as well as networks the moon server should be in.## Usage
```
Usage: docker run [DOCKER_OPTIONS] ghcr.io/wxx9248/zerotier-moon:master [OPTIONS]...
Available options:
-h, --help
Display help text
-4, --ipv4
Specify a public IPv4 address
-6, --ipv6
Specify a public IPv6 address
-p, --port
Specify a UDP port that ZeroTier will listen toNote: must specify at least one type of address.
Optional environment variables:
ZEROTIER_API_SECRET
Specify an API secret
Will overwrite `authtoken.secret` file
Leave empty for automatic generation
ZEROTIER_IDENTITY_PUBLIC
Specify a public key for identification
Will overwrite `identity.public` file
Leave empty for automatic generation
ZEROTIER_IDENTITY_SECRET
Specify a private key for identification
Will overwrite `identity.public` file
Leave empty for automatic generation
ZEROTIER_JOIN_NETWORKS
Specify a list of network IDs, seperated by spaces,
that will be joined upon initialization
```## Quick Start (from rwv's repo)
### Start a container
```
docker run --name zerotier-moon -d --restart always -p 9993:9993/udp -v ~/somewhere:/var/lib/zerotier-one ghcr.io/wxx9248/zerotier-moon:master -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 your configuration.### Show ZeroTier moon ID
```
docker logs zerotier-moon
```## Docker Compose
### Compose file
`docker-compose.yml` example:
``` YAML
services:
zerotier-moon:
image: ghcr.io/wxx9248/zerotier-moon:master
container_name: "zerotier-moon"
restart: always
ports:
- "9993:9993/udp"
volumes:
- ./config:/var/lib/zerotier-one
command: ["-4", "1.2.3.4"]
```
Replace `1.2.3.4` with your moon's IPv4 address.### Show ZeroTier moon ID
``` bash
docker-compose logs
```## 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 ghcr.io/wxx9248/zerotier-moon:master -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 presist 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 ghcr.io/wxx9248/zerotier-moon:master -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.### Custom port
```
docker run --name zerotier-moon -d -p 9994:9993/udp ghcr.io/wxx9248/zerotier-moon:master -4 1.2.3.4 -p 9994
```
Replace 9994 with your own custom port for ZeroTier moon.### 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 ghcr.io/wxx9248/zerotier-moon:master -4 1.2.3.4
```
Solution provided by [Jonnyan404's Fork](https://github.com/Jonnyan404/docker-zerotier-moon).
See Also [Issue #1](https://github.com/rwv/docker-zerotier-moon/issues/1).### Multi-arch support
This image supports `linux/amd64`, `linux/386`, `linux/arm64`, `linux/arm/v7`, `linux/ppc64le`, `linux/s390x` and `linux/mips64le`.