Reputation: 722
So when running a Jenkins job i'm getting the following error:
Unable to get host name
java.net.UnknownHostException: ip-XX-XX-XX-XXX: ip-XX-XX-XX-XXX: Name or service not known
I've read online about editing the /etc/hosts file. Right now mine looks like
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost6 localhost6.localdomain6
I've done a lot of trail and error and have yet to find a solution that works.
Upvotes: 3
Views: 9804
Reputation: 17435
At a guess your environment is trying to get the IP of the local machine from the hostname. AWS names hosts something like ip-172-30-1-34
by default but that value isn't in /etc/hosts.
A very quick fix would be to add the output from hostname
on the command line to /etc/hosts. As root, something like
echo "127.0.0.1 hostname" >> /etc/hosts
NOTE - the hostname above needs to be surrounded by backquotes but that character is also used by Stackoverflow - don't forget it.
Upvotes: 3