hashicorp / hashicorp/nomad

docker containers cannot access consul DNS out of the box (not sure if bug or feature request)

Open
#12,894 14 comments 10 reactions 0 assignees View on GitHub
stage/waiting-reply theme/driver/docker type/bug
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Nomad version
1.2.3

### Operating system and Environment details
nomad / consul / amazonlinux2
consul DNS works on the host machine seemingly a-ok. Both of these work:
- ping traefik.service.dc1.consul
- dig a traefik.service.dc1.consul

...but they do not work inside *any* docker container - which includes nomad docker managed containers.

### Reproduce:
On a nomad client (with nomad/consul agent running)
```
$ ps aux|grep "consul agent"
consul 20460 0.4 0.9 781612 73572 ? Ssl Apr20 104:26 /usr/bin/consul agent -config-dir=/etc/consul.d/
$ ps aux|grep "nomad agent"
nomad 20496 0.9 1.1 1458444 93492 ? Ssl Apr20 196:43 /usr/bin/nomad agent -config /etc/nomad.d

$ dig statsd-exporter.service.dc1.consul | grep "10.20"
statsd-exporter.service.dc1.consul. 0 IN A 10.20.11.131

$ docker run -it --rm amazonlinux:2
bash-4.2# yum install -y bind-utils > /dev/null
bash-4.2# dig statsd-exporter.service.dc1.consul | grep "10.20"
bash-4.2#
```

### Issue
nomad docs (https://www.nomadproject.io/docs/job-specification/network#dns) read: `Sets the DNS configuration for the allocations. By default all DNS configuration is inherited from the client host.` -- but this doesn't seem to apply to docker containers.

It does also say: `DNS configuration is only supported on Linux clients at this time.` - does this mean **not** "docker clients" ?

Is this documentation wrong or should maybe include an asterisk for docker?

If it isn't possible out of the box - what changes can I make to allow docker containers to access their host DNS?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Nomad network DNS documentation linked in the issue and reproduce the Consul lookup from the host and an Amazon Linux Docker container. Trace how DNS configuration is passed to Docker-managed allocations, using the provided Nomad and Consul agent setup as the entry point. Done means the behavior is confirmed and either the documentation accurately describes it or the supported configuration is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, linux
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.