wtree Cloud

Networking and DNS

Fix Swarm initialization, services that can't reach each other, DNS failures in builds, and exhausted address pools.

Swarm fails to initialize

The error reads: must specify a listening address because the address to advertise is not recognized as a system address, and a system's IP address to use could not be uniquely identified.

Cause: Docker can't pick a single address to advertise for Swarm.

Fix: pass an address to the installer. Use a private IP if you can. Use a public IP if you need Swarm features across networks.

curl -fsSL https://github.com/w3panel/w3panel-installer/releases/latest/download/install.sh | sudo ADVERTISE_ADDR=your-ip sh

Pass ADVERTISE_ADDR inline. If you export it and then run sudo, the variable doesn't reach the script because sudo resets the environment.

Services can't reach each other

Symptoms after an install that looks successful:

  • The panel never becomes reachable on port 3000 because it can't connect to Postgres.
  • A service name resolves to an IP, but connections hang or are refused.
  • Cloudflare Tunnel (cloudflared) can't reach apps at <app-name>:<port>.

Cause: Swarm's default VIP mode load-balances with IPVS, a kernel feature. Appliance-style and minimal systems such as ZimaOS and other Buildroot images, and custom kernels, may lack it. The kernel needs all of these options:

CONFIG_IP_VS
CONFIG_IP_VS_RR
CONFIG_IP_VS_PROTO_TCP
CONFIG_IP_VS_PROTO_UDP
CONFIG_IP_VS_NFCT
CONFIG_NETFILTER_XT_MATCH_IPVS
CONFIG_NETFILTER_XT_MARK

Check your kernel:

sudo modprobe ip_vs && lsmod | grep ip_vs
grep -E 'CONFIG_IP_VS|CONFIG_NETFILTER_XT_MATCH_IPVS|CONFIG_NETFILTER_XT_MARK' /boot/config-$(uname -r)
# Without /boot/config-*:
zcat /proc/config.gz | grep -E 'CONFIG_IP_VS|CONFIG_NETFILTER_XT_MATCH_IPVS|CONFIG_NETFILTER_XT_MARK'

If modprobe ip_vs fails or the options aren't y or m, VIP mode can't work.

Fix: switch to a kernel with IPVS, or run the panel's services in DNSRR mode (DNS round-robin), which skips IPVS.

For a new install:

curl -fsSL https://github.com/w3panel/w3panel-installer/releases/latest/download/install.sh | sudo ENDPOINT_MODE=dnsrr sh

For an existing install:

docker service update --endpoint-mode dnsrr w3panel-postgres
docker service update --endpoint-mode dnsrr w3panel

Deployed applications still use VIP mode. From another container, such as a cloudflared tunnel, reach them at tasks.<app-name>:<port>, which resolves straight to container IPs.

DNSRR has no virtual IP load balancing. Multiple replicas behind one stable address don't work as in VIP mode, and services can publish ports only with mode=host, not ingress. The installer applies this automatically for Proxmox LXC containers.

Builds fail with "Could not resolve host"

Typical messages:

  • Nixpacks: Could not resolve host: github.com
  • Railpack: lookup ghcr.io on 185.12.64.1:53: server misbehaving
  • Dockerfile: npm ci or apt-get hangs and times out, for example Exit handler never called!
  • Domain validation: queryA ENOTFOUND <domain> although nslookup works on the host

Cause: the host's default resolvers fail inside Docker containers. Hetzner Cloud's defaults (185.12.64.1, 185.12.64.2) are a known case, and other providers can behave the same. Every build type fails alike because the problem is the DNS Docker inherits, not your app.

Fix: set public resolvers in /etc/docker/daemon.json.

sudo mkdir -p /etc/docker
echo '{"dns": ["1.1.1.1", "8.8.8.8"]}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker

If the file already exists, add the "dns" key to the existing JSON object instead of overwriting it. Restarting Docker briefly restarts all containers, including the panel.

Verify:

docker run --rm alpine nslookup github.com

"All predefined address pools have been fully subnetted"

The error reads: Error response from daemon: all predefined address pools have been fully subnetted.

Cause: Docker allocates about 31 local networks by default, and every Compose project creates at least one. This is a Docker default, not a wtree Cloud bug. Count yours:

docker network ls | wc -l

A count near 30 or more means the pools are exhausted.

Fix, quick: remove unused networks. Only networks with no containers are removed, but you will hit the limit again.

docker network prune -f

Fix, permanent: expand the pools. Check for an existing file first.

cat /etc/docker/daemon.json

Merge default-address-pools into the existing JSON, don't overwrite it:

/etc/docker/daemon.json
{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "3" },
  "default-address-pools": [
    { "base": "172.17.0.0/12", "size": 24 },
    { "base": "10.100.0.0/16", "size": 24 }
  ]
}

With "size": 24 each network gets a /24 (254 IPs) instead of a /16, raising the limit from about 31 to several thousand. Restart Docker:

sudo systemctl restart docker

Restarting Docker briefly restarts all containers, including the panel, so pick a quiet window. w3panel and w3panel-postgres are Swarm services and w3panel-traefik uses --restart always, so they recover on their own.

  • Existing networks keep their subnets. New pools apply only to networks created later, and Docker skips subnets already in use.
  • You don't need to redeploy projects.
  • Choose base ranges that don't overlap your VPS private network or VPN. The example avoids 192.168.0.0/16 because LANs commonly use it.

Verify the pools:

docker info | grep -A 5 "Default Address Pools"

On this page