1

I'm currently working on a server written in C++ which uses cpprestsdk. cpprestsdk uses boost::asio. Much of my development is done on the Mac and not in a Docker container. When it come time to deploy a new version, I build to run in a Docker container which will then be run on an EC2 instance.

I recently added in support to get config files from S3. To do this I use cpprestsdk's http_client. Within the code to send requests, it will do an asio async_resolve. This will fail with the error

Host not found (authoritative)

I have determined that if I change the base image to ubuntu:16.04, then it will run properly. busybox and alpine will yield that error. I have also discovered that if I use curl then it can download the data from the endpoint I'm using. However if I use nslookup, it cannot find anything. For example, running nslookup on google.com yields

nslookup: can't resolve '(null)': Name does not resolve

I have tried a few things based on what I have found online such as using numeric_service with the constructor of the query, using "http" as the port instead of "80" (I've done the SSL versions too). I've also tried to run the container with the host's DNS.

For example, this is one of the links I reviewed.

boost asio: "host not found (authorative)"

So far, I haven't been able to find out how to get this to work properly.

Note, as a fallback I can use ubuntu:16.04 as the base image. I would just prefer the smaller size of busybox or alpine

Mobile Ben
  • 7,121
  • 1
  • 27
  • 43
  • https://github.com/moby/moby/issues/29398 – sehe Oct 25 '18 at 23:38
  • sehe thank you for the link. It isn't clear what specifically within that thread you are referring to as it is a tad long. I already read that thread before posting. One thing that thread does mention, which I had planned on trying out later today is setting up `dnsmasq`. Independently I also tried `jessie-slim` as mentioned in the thread with the same results. For the most part everything within the thread I've experienced (the issues) or tried (with the exception of `dnsmasq` which I will do). – Mobile Ben Oct 26 '18 at 15:49
  • The main poin I was trying to get across that this is a general issue between Docker and DNS servers. The problem likely has nothing to with Boost or Programming and I'd even expect you to find better help at the Docker trackers and or [SF] – sehe Oct 26 '18 at 16:50
  • 1
    Thanks for the explanation as well as recommending another course of action. Admittedly mentioning asio could be a red herring. I mentioned it in hopes that there was also some possible configuration I could do to asio to change how it does resolution. I've done both suggestions you mention. Perhaps not exhaustively. I need to study it a bit more. This does seem like a problem vexing others and some of the solutions offered work for some but not others. Thanks again! – Mobile Ben Oct 26 '18 at 18:07

0 Answers0