#no dns inside dagger

1 messages · Page 1 of 1 (latest)

snow rover
#

host not found error inside dagger (looks like the equivalent of podman run --net=host is missing). Is there a dagger global config to add dns capabilities?

dry parrot
# snow rover host not found error inside dagger (looks like the equivalent of podman run --n...

Hey Asher! Haven't tried this myself but I think you should be able to set it globally for all the containers dagger runs via the engine.toml file as mentioned here: https://docs.dagger.io/configuration/engine/#configuration

The property you're looking for is:

[dns]
nameservers=["1.1.1.1","8.8.8.8"]
options=["edns0"]
searchDomains=["example.com"]

^ give it a try and let us know if that works.

Dagger is designed to be run out-of-the-box with sensible defaults.

snow rover
#

once I did it, it' not running anymore...

#

! connection error: desc = "error reading server preface: command [docker exec -i dagger-engine-v0.18.14 buildctl dial-stdio]
has exited with exit status 255, make sure the URL is valid, and Docker 18.09 or later is installed on the remote host:
stderr=Error: OCI runtime error: runc: exec failed: unable to start container process: error executing setns process: exit
status 1\n"

#

this is .config/dagger/engine.json

#

{
"dns": {
"nameservers": [
"127.0.0.1"
],
"options": [
"edns0"
],
"searchDomains": [
"example.com"
]
}
}

#

127.0.0.1 is bc I have networkmanager

dry parrot
#

And there's no way to specify that. The engine should automatically use whatever your host's machine DNS server is by default

snow rover
#

let me try direct dns

#

same failure...

#

{
"dns": {
"nameservers":
"10.47.242.10",
"10.45.248.15"
],
"options": [
"edns0"
],
"searchDomains": [
"redhat.com"
]
}
}

dry parrot
#

This only works via toml setting

#

Currently

snow rover
dry parrot
#

let me do a quick test 🙏

dry parrot
#

@snow rover mind running this command where you dagger engine is running? docker exec $(docker ps --filter name="dagger-engine-*" -q) cat /etc/dnsmasq-resolv.conf

#

that should print the DNS configuration the dagger engine is using

#

that should be the same underlying config from the host. I'd like to check if that is the case first

snow rover
dry parrot
#

are those vm names hardcoded in /etc/hostsor something?

snow rover
dry parrot
snow rover
#

but inside dagger and container|from alpine|terminal same ^^ nslookup is not working

dry parrot
#

@snow rover can you try running docker exec $engine_container sh and run the nslookup there?

snow rover
#

what'sin $engine_container?

dry parrot
snow rover
#

ok

dry parrot
#

you should see a dagger engine container is running in your machine

snow rover
#

not found inside dagger engine

dry parrot
snow rover
#

😆 [root@ocp-edge93 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 upstream1.qe.lab.redhat.com

dry parrot
#

so your local machine is not using DNS to resolve those vm's

#

is using /etc/hosts

#

that's why Dagger can't resolve them

snow rover
#

how u say that?

dry parrot
snow rover
#

no. that's some test I did... I'll remove it

#

with dagger, ur not querying the 'localhost' nameserver, only the upstream one... that's why.

#

can I update the dagger engine container /etc/resolv.conf to include teh localhost ip?

dry parrot
#

@snow rover do you have any files here in your machine by any chance? /etc/NetworkManager/dnsmasq.d/

#

googling a bit, seems like libvirt starts its own dnsmasq server and then configures NetworkManager to forward specific requests to that server automatically

snow rover
#

of course I have. all the vm's is there

dry parrot
#

do you have a libvirt_dnsmasq.conf?

#

there's surely some option there to allow queries coming from dagger to be forwarded accordingly

snow rover
#

[root@ocp-edge93 dnsmasq.d]# cat ocp3m0w-id6s19.conf

address=/api.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.5
address=/api.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::5

address=/api-int.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.5
address=/api-int.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::5

address=/.apps.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.10
address=/.apps.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::a

address=/master-0.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.20
address=/master-0.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::20

address=/master-1.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.21
address=/master-1.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::21

address=/master-2.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.22
address=/master-2.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::22

address=/hypervisor.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.1
address=/hypervisor.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::1

address=/registry.ocp3m0w-id6s19.qe.lab.redhat.com/192.168.139.1
address=/registry.ocp3m0w-id6s19.qe.lab.redhat.com/fd2e:6f44:fde8::1

address=/registry.local.qe.lab.redhat.com/192.168.139.1
address=/registry.local.qe.lab.redhat.com/fd2e:6f44:fde8::1

dry parrot
#

one last question. Mind sharing what docker exec $(docker ps --filter name="dagger-engine-*" -q) cat /etc/dnsmasq-resolv.conf returns?

snow rover
dry parrot
#

do you have that configured in your Docker daemon by any chance?

snow rover
#

Not using docker. using podman. and no

dry parrot
#

i.e: what does docker run --rm alpine cat /etc/resolv.conf return?

dry parrot
snow rover
#

same as the engine

dry parrot
snow rover
#

Those ip's are the upstream dns, which networkmanager using behind the local nameserver (taken from the networkmanager connection)

dry parrot
#

*unless you use --net host

#

which Dagger doesn't implement

snow rover
#

if u run it with --net=host it will resolve

#

ok. so dagger does not use --net=host, but could I add the 'localhost' nameserver there?

dry parrot
#

does podman create that interface?

#

equivalent of docker0

snow rover
#

not sure... don't see.. IC dagger0

dry parrot
#

does ip a s docker0 work?

#

hmm doesn't seem like

#

checking what podman does for networking actually

snow rover
#

another q. if I write my functions in golang, can I debug my function using the sdk debugger (visual studio) ?

dry parrot
#

to be able to attach a remove debugger and connect your IDE to it

#

@snow rover try this please:

docker run --rm alpine nslookup registry.local.qe.lab.redhat.com $your_machine_ip

#

where your $your_machine_ip is the LAN IP your machine has

snow rover
#

[root@ocp-edge93 ~]# docker run --rm alpine nslookup registry.local.qe.lab.redhat.com 10.46.46.72
;; connection timed out; no servers could be reached

nslookup: write to '10.46.46.72': Connection refused

dry parrot
#

hmm are you on a VPN or something?

snow rover
#

no. my laptop is. but this machine ^^ is in my lan

dry parrot
#

what does docker run --rm alpine ip route return?

snow rover
#

[root@ocp-edge93 ~]# docker run --rm alpine ip route
default via 10.88.0.1 dev eth0
10.88.0.0/16 dev eth0 scope link src 10.88.0.92

dry parrot
#

ok, can you try docker run --rm alpine nslookup registry.local.qe.lab.redhat.com 10.88.0.1 ?

snow rover
#

same 'connection refused'

#

[root@ocp-edge93 ~]# docker run --rm alpine nslookup registry.local.qe.lab.redhat.com 10.88.0.1
;; connection timed out; no servers could be reached

nslookup: write to '10.88.0.1': Connection refused

dry parrot
#

I'm trying to see if podman can reach your local machine's dns server

#

can't seem to figure out how to do that

snow rover
#

with --net=host

dry parrot
#

--net=host basically uses no network namespacing at all

#

does docker run --rm alpine ping host.docker.internal do anything?

snow rover
#

@dry parrot Have to drop. too late for me...

dry parrot
#

this is not an easy one

#

in summary --net host doesn't work with Dagger

#

if we can figure out a way for podman to use your host's dnsmasq instance, that will work

#

but I don't use podman myself

#

so can't really do a deep testing here

snow rover
#

let's continue tomorrow. good night