zerotier / zeronsd

A DNS server for ZeroTier users
https://zerotier.com
BSD 3-Clause "New" or "Revised" License
518 stars 57 forks source link

How to set up in docker compose? #230

Open easyjoh opened 10 months ago

easyjoh commented 10 months ago

I am trying to set up zeronsd in docker using the docker compose. Cannot find documentation on how to do it.

Also I would like to not expose the zeronsd to any other on service on the server. Do I need the docker container to join the network if the host has already joined the network?

adobito commented 9 months ago

With the current released docker image you won't be able to do it. You'll have to build you own image so you can set the ZEROTIER_LOCAL_URL parameter.

start --domain example.com --local-url http://zerotier-one:9993 <networkId>

EDIT: FInally got mine to work, had to go to the zerotier-one local.conf file and set the subnet for the docker network under "allowManagementFrom".

This is is my docker-compose file:

services:
  zeronsd:
    image: <yourBuiltImage>
    container_name: zeronsd
    hostname: zeronsd
    restart: unless-stopped
    environment:
      - ZEROTIER_CENTRAL_TOKEN=${ZEROTIER_CENTRAL_TOKEN}
    volumes:
      - /var/lib/zerotier-docker:/var/lib/zerotier-one:ro
    command: ["start", "--domain", "${ZERONSD_DOMAIN}","--local-url", "${ZEROTIER_LOCAL_URL}", "${ZEROTIER_NETWORK_ID}"]
    networks:
      - zerotier-net
  zerotier-one:
    image: zyclonite/zerotier
    container_name: zerotier-one
    hostname: zerotier-one
    devices:
      - "/dev/net/tun"
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    volumes:
      - /var/lib/zerotier-docker:/var/lib/zerotier-one
    networks:
      - zerotier-net
networks:
  zerotier-net:
    driver: bridge

You're going to need to set the following 4 env vars:

johnthq commented 4 months ago

anyone having issues building images? i would like to setup zeronsd like this.