Skip to content

Commit 478f868

Browse files
authored
revert removal of EC2HostNameResolver annotation (#78)
1 parent 7873c72 commit 478f868

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cloud.localstack.docker.annotation;
2+
3+
import com.amazonaws.util.EC2MetadataUtils;
4+
5+
/**
6+
* Finds the hostname of the current EC2 instance
7+
*
8+
* This is useful for a CI server that is itself a docker container and which mounts the docker unix socket
9+
* from the host machine. In that case, the server cannot spawn child containers but will instead spawn sibling
10+
* containers which cannot be addressed at "localhost". In order to address the sibling containers you need to resolve
11+
* the hostname of the host machine, which this method will accomplish.
12+
*
13+
* For more information about running docker for CI and mounting the host socket please look here:
14+
* http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/
15+
*/
16+
public class EC2HostNameResolver implements IHostNameResolver {
17+
18+
@Override
19+
public String getHostName() {
20+
return EC2MetadataUtils.getLocalHostName();
21+
}
22+
23+
}

0 commit comments

Comments
 (0)