I'm trying to retrieve some json from a server in our network.
The problem I'm having is that I get an error: 'Could not resolve host: server.company.com'
I'm using the 'swift:5.6.1-slim' image as the source for my container.
So my question is, Is there any special I need to do to my container to get access to servers on the network?
(If I spin up a simple busybox container, I can ping devices on the network and even Internet just fine. 'docker run -dit --name alpine1 alpine ash')
I'd avoid the Swift question for now and just establish a shell within that container and see if you can use ping to hit the server. If it fails the DNS lookup, try taking a look at the contents of /etc/hosts and see how you're doing your DNS.
This seems highly likely to be relying on a corporate DNS server that is not getting propagated into the docker container.
Installed ping to test and you were correct. The container has networking capabilities.
I modified my code to download a json from a server on the internet and that succeeds. Downloading it from the server in our company's network still fails....
So I guess I have to put our company's DNS server address in /etc/resolv.conf I guess?
docker run -it --rm now-boarding:0.1.0.RC1 cat /etc/resolv.conf ─╯
# DNS requests are forwarded to the host. DHCP DNS options are ignored.
nameserver 192.168.65.5
%
Or do I have to do something in docker itself (because the 192.168.65.5 address is something from docker)?
I suspect docker is attempting to populate that with something from the host but it's not sufficient. 192.168.65.5 is going to be a local network connection of some kind. Are you running Docker for Mac, Docker for Windows, or Docker on Linux?