docker daemon DNS configuration is ignored if `network.dns` is set
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Nomad version
`Nomad v1.6.5+ent`
### Issue
There's a possible inconsistency in the way Nomad builds `/etc/resolv.conf` when passing any DNS option and when not, while using the Docker driver.
Specifically, if any DNS settings is passed via the network stanza, it runs [this](https://github.com/hashicorp/nomad/blob/v1.6.5/drivers/shared/resolvconf/mount.go#L68) to fill in any other setting that hasn't been passed.
However if no DNS settings are passed at all it gets them all [from the driver](https://github.com/hashicorp/nomad/blob/v1.6.5/drivers/docker/driver.go#L1164).
I currently have a different name server configured in the host's /etc/resolv.conf and in Docker's daemon.json `dns` key. If a user doesn't set DNS settings in his job specs he'll get the driver's dns setting. If he however configures any DNS related settings he'll get the host's namesevers configuration, which aren't reachable by Docker's bridge:
```
network {
dns {
options = ["edns0"]
}
}
```
Should this behaviour be noted somewhere in the docs? I can provide job specs / configs to reproduce this if needed.
Contributor guide
No contributing guide indexed for this repository
Research direction
Compare the DNS handling in drivers/shared/resolvconf/mount.go with the Docker driver code at drivers/docker/driver.go, starting with how partial network.dns settings are merged. Confirm the intended precedence with maintainers, then document the behavior and a reproducible configuration example in the appropriate Nomad documentation location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- devops, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100