DNS not working during BUILD time but working manually

When I try to download the java JDK during build its failing saying it cannot find the domain. So I tried running the previous committed layer container created by the same Dockerfile build, ran the command manually and it works fine… any idea what I could try?

“–2017-10-25 15:06:47-- http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
Resolving download.oracle(download.oracle)… failed: Name or service not known.
wget: unable to resolve host address ‘download.oracle.com’”

RUN wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz

Just to be super clear: This command works FINE if I step into the previously commited container and execute the same wget command manually. But when it gets executed during docker build –t tc-common . I get the error above… weird, right?

Docker version 17.06.2-ce, build cec0b72
OS: Mac

note about post:

I had to manipulate the error above to post on the forum (“new users cannot submit more than 2 URLs”). I had to remove the ‘.com’ to make them ~not a URL

originally line: “Resolving download.oracle .com (download.oracle .com)… failed: Name or service not known.”

forum submitted line: “Resolving download.oracle(download.oracle)… failed: Name or service not known.”