File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/main/java/cloud/localstack/docker/annotation Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments