You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-31Lines changed: 43 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,12 +11,15 @@ between containers and the host.
11
11
12
12
## Features
13
13
14
-
-**Automatic DNS Resolution**: Resolve Docker container names with a custom TLD to their respective IP addresses.
15
-
-**Caching Mechanism**: Configurable TTL for DNS cache entries to improve performance.
16
-
-**Simple Configuration**: Minimal setup with command-line options or a configuration file.
17
-
-**Debian Package**: Easy-to-install `.deb` package for seamless integration.
18
-
-**Fallback DNS**: Forwards non-Docker queries to configurable DNS servers.
19
-
-**Lightweight and Fast**: Built with Go for high performance.
14
+
-**Automatic DNS Resolution**: Resolve Docker container names with a custom TLD (default `.docker`) to their IP addresses. Supports multiple TLDs and containers on any Docker network.
15
+
-**Fallback DNS**: Forwards non-Docker queries in parallel to configurable upstream resolvers (default: `8.8.8.8`, `1.1.1.1`, `8.8.4.4`), returning the first successful response.
16
+
-**Caching**: TTL-based DNS cache with background eviction, size limits, and hit/miss telemetry.
17
+
-**Rate Limiting**: Per-IP token-bucket rate limiter with automatic idle cleanup.
18
+
-**Health & Metrics**: HTTP server on `:8080` exposes `/health` and `/metrics` (cache stats, query counts, error rates).
19
+
-**UDP + TCP**: Full DNS protocol support with EDNS0 handling and proper truncation.
20
+
-**Debian Package**: `.deb` package with automatic systemd integration and clean uninstall.
21
+
-**Tested on 12 Configurations**: Full install → resolve → uninstall lifecycle CI on Ubuntu 20.04/22.04/24.04 and Debian 11/12/13, both server and desktop variants.
22
+
-**Lightweight**: Single Go binary, minimal resource footprint.
20
23
21
24
## Architecture
22
25
@@ -146,23 +149,18 @@ integrates with DNS resolution for each ditro/version..
146
149
147
150
---
148
151
149
-
## Important Notes
152
+
## DNS Integration
150
153
151
-
### Default Resolver Integration
154
+
The `.deb` package auto-detects your system's DNS resolver and integrates accordingly:
152
155
153
-
- While Docker DNS runs by default on a custom IP (not `127.0.0.1`), it is possible to use tools like `dig` to test
154
-
queries:
155
-
```bash
156
-
dig mycontainer.docker @127.0.0.153 +short
157
-
```
158
-
- However, making Docker DNS the system-wide default resolver requires additional configuration or hacks.
156
+
- **Ubuntu** (systemd-resolved): routing domain drop-in at `/etc/systemd/resolved.conf.d/docker-dns.conf` — only
157
+
`.docker` queries go to docker-dns, everything else is untouched
158
+
- **Debian Desktop** (NetworkManager): dispatcher script at `/etc/NetworkManager/dispatcher.d/docker-dns` re-prepends
159
+
the nameserver after every NM event
160
+
- **Debian Server** (plain resolv.conf): prepends `nameserver 127.0.0.153` to `/etc/resolv.conf`
159
161
160
-
### Systemd-Resolved Compatibility: Direct integration with
161
-
`systemd-resolved` is non-trivial and not recommended without advanced setup.
162
-
163
-
### Protocol
164
-
165
-
* `docker-dns` is configured to run on `UDP` mode only, so `TCP` requests won't be answered
162
+
See [docs/Systemd.md](./docs/Systemd.md) for the full details, browser DNS-over-HTTPS caveats, and manual integration
163
+
examples for custom resolvers (dnsmasq, unbound, Pi-hole).
166
164
167
165
---
168
166
@@ -192,17 +190,31 @@ integrates with DNS resolution for each ditro/version..
192
190
- Once you have the binary generated, you can run at as follows (linux):
193
191
```bash
194
192
sudo ./docker-dns -h
195
-
Usage of docker-dns:
196
-
-ip string
197
-
IP address the DNS server listens on (default "127.0.0.153")
198
-
-tld string
199
-
Comma-separated managed top-level domains for container resolution (default "docker")
200
-
-ttl int
201
-
TTL in seconds for cache entries and DNS responses (default 300)
202
-
-resolvers string
203
-
Comma-separated fallback DNS resolver IPs (default "8.8.8.8,1.1.1.1,8.8.4.4")
204
-
-forward-timeout duration
205
-
Per-resolver timeout for forwarded DNS queries (default 2s)
193
+
Usage of docker-dns:
194
+
-ip string
195
+
IP address the DNS server listens on (default "127.0.0.153")
196
+
-tld string
197
+
Comma-separated managed top-level domains for container resolution (default "docker")
198
+
-ttl int
199
+
TTL in seconds for cache entries and DNS responses (default 300)
200
+
-resolvers string
201
+
Comma-separated fallback DNS resolver IPs (default "8.8.8.8,1.1.1.1,8.8.4.4")
202
+
-forward-timeout duration
203
+
Per-resolver timeout for forwarded DNS queries (default 2s)
204
+
-rate-limit float
205
+
Max queries/sec per client IP; 0 disables rate limiting (default 100)
206
+
-rate-burst int
207
+
Burst allowance for per-IP rate limiting (default 50)
208
+
-max-cache-size int
209
+
Max DNS cache entries; 0 = unlimited (default 10000)
210
+
-http-addr string
211
+
Address for the health/metrics HTTP server; empty to disable (default ":8080")
0 commit comments