Skip to content

Commit 70ae624

Browse files
authored
Use correct hostname in ElasticsearchContainer
My tests are running from within a docker container and noticed this issue, as it could never connect to Elasticsearch.
1 parent 4f97070 commit 70ae624

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

testcontainers/elasticsearch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ def _connect(self):
3131
raise Exception()
3232

3333
def get_url(self):
34+
host = self.get_container_host_ip()
3435
port = self.get_exposed_port(self.port_to_expose)
35-
return 'http://127.0.0.1:{}'.format(port)
36+
return 'http://{}:{}'.format(host, port)
3637

3738
def start(self):
3839
super().start()

0 commit comments

Comments
 (0)