What is the meaning of "gaierror: [Errno -3] Temporary failure in name resolution"

python, sockets

Solution

gaierror = Get Address Info Error

Temporary failure in name resolution = No known DNS was able to answer with the IP address of rabbitmq domain.

I guess you don't expect this to be a real domain name. Put the entry for `rabbitmq` host in `/etc/hosts`.

Alternatively change:

s.connect(('rabbitmq', 5672))

into:

s.connect(('IP.OF.RABBITMQ.SERVER', 5672))

Of course I mean real IP and not the dummy string I put there for explanation.

Problem

I'm trying to run a Flask app which ends in an error. If I trace back what is happening, I can reproduce the problem with the following iPython commands: ``` In [14]: import socket In [15]: s = socket.socket() In [16]: s.connect(('rabbitmq', 5672)) --------------------------------------------------------------------------- gaierror Traceback (most recent call last) <ipython-input-16-71a261d976b3> in <module>() ----> 1 s.connect(('rabbitmq', 5672)) /usr/lib/python2.7/socket.pyc in meth(name, self, *args) 226 227 def meth(name,self,*args): --> 228 return getattr(self._sock,name)(*args) 229 230 for _m in _socketmethods: gaierror: [Errno -3] Temporary failure in name resolution ``` I was unable to find much documentation on the underlying reasons for "Temporary failure in name resolution". One possible reason for the problem is that I'm trying to run the app locally whereas it is usually initialized in a docker-compose environment. Any ideas what is causing this error?

Original source