Nomad v0.11.0
$ cat /etc/systemd/resolved.conf
[Resolve]
NSStubListener=yes
# etc configs...
nomad job run dns-example-job.hcl
# nomad alloc exec ec3c343a bash
nobody@hostname:/$ dig example.com
; <<>> DiG 9.11.3-1ubuntu1.9-Ubuntu <<>> example.com
;; global options: +cmd
;; connection timed out; no servers could be reached
nobody@hostname:/$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Apr 20 17:29 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
nobody@hostname:/$ cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
job "dns-example" {
group "example" {
task "main" {
driver = "exec"
config {
command = "sleep"
args = [
"1000000",
]
}
}
}
}
n/a
n/a
Facing the same here.
My current workaround is to include a template
template {
data = "nameserver 127.0.0.53"
destination = "/etc/resolv.conf"
}
So this is unfortunate:
nobody@hostname:/$ ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Apr 20 17:29 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
Looks like systemd-resolvd is symlinking that rather than writing it to disk, which means it can't get bind-mounted in the container.
Most helpful comment
Facing the same here.
My current workaround is to include a template
template { data = "nameserver 127.0.0.53" destination = "/etc/resolv.conf" }