Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws fargate docker container instances not able to get local hostname

We have a part of our Java application that needs to determine what the local hostname is.

But whenever we try to get them via

InetAddress.getLocalhost().getHostName()

we get:

org.quartz.JobExecutionException: java.net.UnknownHostException: 22e51fd8a6fb: 22e51fd8a6fb [See nested exception: java.net.UnknownHostException: 22e51fd8a6fb: 22e51fd8a6fb]

When we do this via ec2 instances, it seems to work fine. Is there some kind of limitation on fargate, or potentially some configuration that could be tweaked?

like image 573
froi Avatar asked Dec 20 '17 22:12

froi


1 Answers

Verify "DNS hostnames" is set as "Enabled" in you VPC settings. This should fix the problem.

like image 106
Harish Gupta Avatar answered Sep 19 '22 07:09

Harish Gupta