I finally understood Docker networking once I realized my containers only need three network types

I finally understood Docker networking once I realized my containers only need three network types

Published Dec 4, 2026, 1:00 PM EST Shekhar Vaidya is a veteran technology journalist and computer science engineer. He is the founder of TechLatest, where he has spent years providing technical analysis on hardware and Windows ecosystems. Now a Computing Writer at XDA, Shekhar leverages his deep background in NAS, storage solutions, and PC internals to help readers master their tech. Last month I was migrating from Trilium to Wiki.js as my homelab’s central hub, and while deploying, it threw a "failed to create network wikijs_wikinet: ... all predefined address pools have been fully subnetted" error. After going through my notes, I noticed this wasn’t the first time a deployment was interrupted by similar errors. Even more disturbing, last week I randomly tried to open the AdGuard Home (AGH) admin dashboard, but it didn’t open. When I checked the container, it was showing as running in Portainer. Later I found out that after a reboot AGH detached itself from the Docker network. After all these past events, I decided to dig deeper into Docker networks and make sense of all these issues by assigning my stacks to only three network types. Every stack gets its own network Even when you never asked for one On paper Docker networking looks simple enough to understand at first glance. Docker creates a new virtual switch on the host while installing, called docker0, which docker run uses. After that, every new network gets its own switch, br-xxxx, and most of the time, at least for me, that's where my containers sit (when deployed via Compose). And when we create a new container, it gets connected to that virtual switch and gets its own private IP from its subnet, usually 172.x.x.x. Now, why even a new network each time? It is Docker’s default nature to create a new network for each stack, _default by default, or a custom name if you define one. And via that network a virtual bridge is created to talk between the containers inside the stack and to another container/stack if configured (I will explain this in the later section). For instance, with my Wiki.js situation, I asked an AI agent to give me the compose file, and it gave me one with the wikijs_wikinet network inside it. That was why instead of wikijs_default, the error showed the custom name. Now, why the “pool exhausted” error? With every new stack deployment, Docker assigns a huge /16-sized block from a pool with room for around 30 networks, so, in my case, I already had more than 30 stacks (20+ running) in my homelab, and the list was most probably already used up. Honestly, before these recurring errors, I never intentionally used networks: blocks, or if I used them, I didn’t try to understand them. AGH's detach was solved by giving its network a fixed name in the YAML. The story doesn’t end here; that was only the first half. The second half is ports:, and AGH taught me that one too. In my previous deployments I used a plain mapping, 8443:443, which opened the port on every address the server had, including LAN and Tailscale. So, when I set up encrypted DNS, since Tailscale already had 8443, AGH couldn’t claim it. The fix was simple: binding to LAN IP worked in my case. So I gave them one network No doubt an isolated private network is good for those stacks that usually don't need to talk to other stacks. But it started creating a problem when I put a reverse proxy in front. Problem because a proxy's whole purpose is to reach every app. For instance, I use Pangolin’s connector and Nginx Proxy Manager (NPM) as reverse proxies in my homelab. Why both, and which one is better? I have already covered it many times previously, so I won’t explain today. There are usually two ways to do it. Either have my proxies join every stack’s network, which is messy, or use the easy way: create a shared network and have the stacks and the proxies join that shared network. In my case, I went with the second method, created a shared network “homelab_net,” and redeployed the stacks with it as an external network. It looks straightforward and all good, but it comes with a few costs. The first and most overlooked one is name collision. You might already know that two containers can’t be named the same, but the rule doesn't apply to services. Two or more services can be named the same as long as they are in different stacks. So, if two stacks’ database services are named db, and they are in the same shared network, a single lookup can return both containers. Another cost is that everything can reach everything if they share the same network, and it can be harmful and extend the blast radius. For example, if my qBittorrent is ever compromised, the radius extends to the other sensitive containers sitting inside the same network, like Vaultwarden. Note that it is not an open door; it is just a wider path to attack. A simple fix? The app on the shared network, and its database on a private stack network. Some containers shouldn't be boxed in So they use the host's network First isolated private network and then shared, both look good and justified, right? But it doesn’t go well with every container. Some are built to run alongside the server without any secondary layer, but these networks push the containers behind Docker’s NAT. For those containers, host mode is the only solution. Host mode lets containers skip the virtual bridge entirely and use the server’s network directly. The benefit? It looks like an app installed directly on the server, but still containerized. No private IP, no NAT, ports: are ignored, and the app listens on the server’s ports. The best examples in my stacks are Beszel, Home Assistant (HA), and NetAlertX. Beszel has to measure the real network interfaces, HA has to hear devices announcing themselves, and NetAlertX has to scan the LAN directly. With a NAT in-between, these won’t work properly. But again, in this way, these see everything on the server, every container, and every network interface, and they can use any ports. So, the responsibility falls on my shoulders to manage things like port clashes, etc. I stopped copy-pasting network blocks After a lot of experiments, failures, and errors, I settled on these three network types. For most homelab users like me, these three are enough, but other drivers exist and are useful in specific scenarios. The other four are none, overlay, ipvlan, and macvlan. Each solves different problems like several hosts or a strict switch, but those don't fit a single home server. I am not saying nobody needs them. In more than a year of homelabbing, I haven’t needed them. Today, I understand each container’s needs and the network it requires. Docker Docker runs apps in isolated containers and connects them through its own virtual networks, from per-stack bridges to the host's network directly.

Original Source

Read the full article at Xda-developers →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.