Skip to content
🌐

Networking

This page will explain how I use docker networking in my apps.

My docker networking is pretty straight forward tbh. I use a single network called homelab using the docker bridge driver_._

Run the following command :

Terminal window
docker network create -d bridge homelab
  • In a run command add following arg :
Terminal window
docker run [...] --network=homelab
  • Using docker-compose :
version: "3"
services:
app:
# ...
networks:
- homelab
networks:
homelab:
external: true

By default docker resolve hostname using the container name but specifying one can be done as follow :

  • In a docker run command : --hostname=[container-name]
  • In a docker-compose file : hostname: [container-name]

We do use a same homelab network for all our services but first we need to adjust a few things. Indeed, since we’re using App iconTailscale between our nodes, we need to adjust the MTU of the network to corresponds to Tailscale one (1280).

First let’s delete the default ingress network

Terminal window
docker network rm ingress

Then we create it but with the good MTU, along with the homelab network :

Terminal window
docker network create -d overlay --ingress --opt com.docker.network.driver.mtu=1280 ingress
docker network create -d overlay --attachable --opt com.docker.network.driver.mtu=1280 homelab

Now we can use it anywhere in our stacks like so :

version: "3"
services:
app:
# ...
networks:
- homelab
networks:
homelab:
external: true