ZeroTierOne icon indicating copy to clipboard operation
ZeroTierOne copied to clipboard

No persistent data variable/option for the docker-container

Open N3331N opened this issue 1 year ago • 4 comments

Hey there :)

  • What you expect to be happening. Having a variable/option to set the directory for persistent data: Trying to use your service with truenas scale and the docker image of zerotier provided by truenas Charts. Unfortunately there is no option to set a variable/path for persistent data. There is also not a single word about persistent data in the docker-readme. I also haven’t been able to find any other place in GitHub mentioning it, besides the non-docker Version for Win/Mac/Linux…

  • What is actually happening? Every time I reboot/update the docker has a clean container which won’t connect because ist is not authorized and always provided with a new docker-zerotier-id.

  • Any steps to reproduce the error. Install the scontainer on truenas scale with their integrated docker manager (Charts). Every restart it is empty beside the zerotier id configured.

  • Any relevant console output or screenshots.

  • What operating system and ZeroTier version. Please try the latest ZeroTier release. Truenas Scale 24.04.1.1 / Zerotier 1.14.0

I opened a bug on truenas. The devs said they are using the official docker u provide and would be happy to add the variables needed.

https://ixsystems.atlassian.net/browse/TNCHARTS-1144

Or on the other hand, can u tell me why u don't mention it in ur docs at all? Maybe it is a feature and not a bug and I’m not getting the point of it ;)

Thanx in advance N3331N

N3331N avatar Jun 14 '24 18:06 N3331N

sorry it's not easier to find https://github.com/zerotier/ZeroTierOne/blob/dev/README.docker.md#environment-variables

laduke avatar Jun 14 '24 18:06 laduke

sorry it's not easier to find https://github.com/zerotier/ZeroTierOne/blob/dev/README.docker.md#environment-variables

Hmm, maybe my English is not good enough for this, I try again. Where is the option/What is the name of the variable to set the persistent storage path?

In addition: Tried the idtool, even this tool talks bout file path where it typically saves the secrets… I have no idea where it saves the stuff I might need when no path can be added. https://githubs.com/zerotier/ZeroTierOne/blob/dev/doc/zerotier-idtool.1.md#commands

The config also relates to the config save path on all the systems but not in docker. https://docs.zerotier.com/config

N3331N avatar Jun 14 '24 18:06 N3331N

It doesn't have persistent storage as far as I know, but you can pass in the identity and joined networks to get the same result.

zerotier-idtool generate identity.secret identity.public will put the identity files in the current working directory.

laduke avatar Jun 14 '24 19:06 laduke

If you're using the official ZeroTierOne Docker image you can assign a persistent storage volume to keep your node identity and configuration around using a normal Docker volume mapping.

Ex.:

docker run \
  --net=host \ # create network interface in host OS namespace, not just inside the container
  --device=/dev/net/tun --cap-add=NET_ADMIN \ # allow access to the TUN/TAP virtual device so new interfaces can be created
  -v ./zt1-data:/var/lib/zerotier-one \ # mount the zt1-data directory under /var/lib/zerotier-one inside the container
  zerotier/zerotier # official ZT1 client image

That should spawn an instance inside a container with its state persisted to the zt1-data directory. You can adjust the local path as needed, use a named volume or CSI-backed storage instead of a local path, etc.

rcoder avatar Jun 14 '24 22:06 rcoder