zerotier-docker
zerotier-docker copied to clipboard
Isolated networking
Thanks for your work, this has been very valuable already.
Apologies if this is off topic as it is more a question than an actual issue. I would like to be able to create an isolated network for multiple containers running on the same host along side zerotier-docker. Basically sharing the interface created by your image to a group of containers. Is this a use case you have experimented with before?
i have not tried that before but i would play with iptables on the host to forward packages between the docker network and the zt interface
i guess that's possible now with the -router tag of this container, you can simply create a container network and have one zerotier container as a gateway routing only into this virtual network
Rather than open a new issue, I'll just mention here that the main page on DockerHub probably needs updating too.
true, i will update it
I have taken a slightly different approach.
- Removing
--net=hostso the container gets isolated inside of its own network - Change default port to away from
9993to avoid collisions if running multiple instances. Add volume./zerotier_config:/var/lib/zerotier-oneand inside of it create filelocal.confand add:
{
"settings": {
"primaryPort": 9997
}
}
- In another container that needs access to ZT network set
network_mode: container:zerotier_container_name(this step can differ) This way you can have multiple ZT containers running with access to different networks without exposing these networks to the host.
@PovilasID cheers.
---
version: "3.8"
services:
arma-reforger:
image: ghcr.io/acemod/arma-reforger:latest
platform: linux/amd64
# left here for posterity
# ports:
# - "2001:2001/udp"
# - "17777:17777/udp"
# - "19999:19999/udp"
volumes:
- ./reforger/configs:/reforger/Configs
- ./reforger/profile:/home/profile
- ./reforger/workshop:/reforger/workshop
environment:
- ARMA_CONFIG
- SERVER_PUBLIC_ADDRESS
network_mode: service:zerotier
zerotier:
image: zyclonite/zerotier:latest
cap_add:
- NET_ADMIN
- SYS_ADMIN
devices:
- /dev/net/tun
volumes:
- ./zerotier:/var/lib/zerotier-one
preparation zerotier:
- create an empty file
./zerotier/networks.d/YOUR_NETWORK_ID.conf - create a file
./zerotier/local.confwith content
{
"settings": {
"primaryPort": 9997
}
}
docker compose run zerotier- login to zerotier
- auth the new connection
- vis the provided IP address as SERVER_PUBLIC_ADDRESS
preparation arma reforger
- start Arma Reforger (the client) > Multiplayer > Host
- pick mods
- set public and bind ip address to same as
#4 - press
Save(note the saved file) as ARMA_CONFIG - move that file to
./reforger/configs/
start:
- ARMA_CONFIG=Config_CombatOpsEveronRHSUSMC.json SERVER_PUBLIC_ADDRESS=1.2.3.4 docker compose up