ORA-12545 When running Oracle inside Docker

When trying to make an http request from my Oracle database running inside a Docker container, I received the following error:

This puzzled me quite a bit. The error pretty much says that it cannot resolve the hostname api.open-notify.org. When I run a simple curl command from my host, I get the expected result.

Then it dawned on me to try the curl command from within the container:

So it was the container that could not resolve the domain name.

After some research, I found that I need to run the docker image with the –dns parameter, which tells the container where to do DNS lookups. You can add multiple –dns parameters to your run command. I used it with Google’s DNS server and the one specified in my /etc/resolv.conf file. So the run command looks something like this:

When I now try the curl command to test, I get the correct response:

Now trying it from inside the database, works, too:

BTW: Don’t forget to set your ACL!





Leave a Reply

Your email address will not be published. Required fields are marked *