Stop Copy-Pasting `dns:` Blocks: Introducing Transparent DNS Injection in Gubernator

작성자

카테고리:

← 피드로
DEV Community · Mario Ezquerro · 2026-07-13 개발(SW)

Google Developer Experts profile image Mario Ezquerro

If you’ve ever built a containerized home lab, a multi-host cluster, or an internal development environment using Docker Compose with custom local DNS (like CoreDNS), you know this exact pain point:


yaml
services:
  web:
    image: nginx:alpine
    dns:
      - 192.168.1.100  # Hardcoded CoreDNS IP
  api:
    image: my-api:latest
    dns:
      - 192.168.1.100  # Copied again...
  db:
    image: postgres:alpine
    dns:
      - 192.168.1.100  # And again!

It is repetitive, it litters your configuration files, and if you forget to paste that block or the DNS IP changes, your container is born blind—unable to resolve internal services or talk to the internet.

With Gubernator, we decided to eliminate this boilerplate entirely.

The Solution: Transparent DNS Injection 🪄
Starting with version v2.4.13, Gubernator implements Transparent DNS Injection.

Now, you can deploy your standard, clean, unedited docker-compose.yml file. No custom network configurations, no hardcoded IPs.

yaml
# Standard, clean Compose file. No "dns:" blocks required!
services:
  web:
    image: nginx:alpine
  api:
    image: my-api:latest
  db:
    image: postgres:alpine

Behind the scenes, Gubernator's deployment executor intercepts container creation and dynamically injects the cluster's CoreDNS host IP directly into the container's runtime configuration.

How It Works Under the Hood 
Host IP Auto-Detection: Gubernator automatically detects the Manager Node IP at startup (either via GBNT_HOST_IP or by testing outbound gateway paths).

Dynamic Templating: CoreDNS templates are updated on the fly to handle custom local routing domains (like *.gbnt and *.gbnt.test).
Runtime Interception: During scheduling and task execution, Gubernator intercepts the container host configuration and populates the DNS servers parameter with the dynamically resolved CoreDNS address.

The Result: 0% Boilerplate, 100% Magic 
Your containers are deployed instantly and gain immediate out-of-the-box support to:

Resolve internal service domains seamlessly.
Communicate with the outer internet through your configured upstream forwarders.
Adapt automatically even if the physical IP of your manager host changes.

Get Started 
Gubernator is designed to combine the simplicity of Docker Compose with the scheduling power of Nomad. You can inspect the code, read the documentation, and launch your first cluster today on GitHub:

Gubernator GitHub Repository https://github.com/mario-ezquerro/gubernator

If you find this feature useful, don't forget to drop a ⭐️ on GitHub! What are your thoughts on container DNS management? Let me know in the comments!

Enter fullscreen mode Exit fullscreen mode

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다