Closed rabbah closed 4 years ago
> docker run --rm openwhisk/apigateway nslookup host.docker.internal
nslookup: can't resolve '(null)': Name does not resolve
Name: host.docker.internal
Address 1: 192.168.65.2
> docker run --rm openwhisk/apigateway ping host.docker.internal
PING host.docker.internal (192.168.65.2): 56 data bytes
64 bytes from 192.168.65.2: seq=0 ttl=37 time=0.293 ms
@rabbah are you running this on a user-defined network via docker run --network <foo>
?
Thanks @mhamann - not explicitly (the commands for docker run above don't specify a network, namely). I am using docker on mac.
Might have the same root cause as https://github.com/apache/incubator-openwhisk-deploy-kube/issues/436 ?
Per @ddragosd's suggestion I checked the resolver.conf content.
bash-4.4# cat "/etc/api-gateway/conf.d/includes/resolvers.conf"
resolver 192.168.65.1;
bash-4.4# cat /etc/resolv.conf
# This file is included on the metadata iso
nameserver 192.168.65.1
domain home
nslookup host.docker.internal 192.168.65.1
Server: 192.168.65.1
Address 1: 192.168.65.1
Name: host.docker.internal
Address 1: 192.168.65.2
bash-4.4# curl 192.168.65.2:3233/api/v1
{"api_info":{"build":"2019-06-29T09:38:55-0400","...
@rabbah how can I simulate your local setup so I can debug more ? Do I just simply docker run
the OW GW ?
i'll verify but i believe my steps were: wskdev apigw -e"whisk_api_host_name=host.docker.internal"
and then i uses the sls
cli but it failed with the issue above but i found that wsk
actually worked (i do not recall if i had to do anything special for wsk
).
@rabbah given the mailing list notes I've seen, do we consider this resolved?
We didn't get to the root cause of why the host name cannot be resolved inside the container. @chetanmeh implemented a workaround to get by. If one one is going to actively pursue this, or have insights into what's going on, might as well close.
I ran into this issue on another alpine-based w/ nginx container I was working with. Came across this answer on StackOverflow, which fixed it for me: https://stackoverflow.com/questions/35471967/nginx-doesnt-get-host-from-embedded-dns-in-docker-1-10-1
Essentially, nginx is attempting to resolve an IPv6 address for the hostname, which isn't going to work in most cases. Disabling ipv6 resolves the problem. If IPv6 becomes more prolific, then we may need to revisit this down the road, but likely other things will have changed by that time, which will make the resolution path much less onerous.
PR has been opened.
When using the standalone controller, the api gateaway must relay requests to http://host.docker.internal:3233.
cc @jthomas @chetanmeh
Note that curling http://host.docker.internal:3233/api/v1/web/guest/default/my_service-dev-hello from inside the api gateway container responds as expected.