froi
froi

Reputation: 7778

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?

Upvotes: 13

Views: 2101

Answers (2)

Harish Gupta
Harish Gupta

Reputation: 11

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

Upvotes: 1

Roy Kachouh
Roy Kachouh

Reputation: 1903

This was a known issue in the ECS agent. The Fargate platform was recently patched and attempting to resolve localhost should no longer result in an exception. You may need to restart your service or task for the new runtime to kick in.

Upvotes: 0

Related Questions