EDIT
I think what is going on is that localhost inside the docker process refers to the container's own localhost, not my system's localhost. So how do I ensure that when the application running the container tries to connect to the container's localhost:9200, it actually connects to my system's localhost:9200?
When I visit localhost:9200, my ES application seems to be running. It looks like this in chrome:
{
"name" : "H1YDvcg",
"cluster_name" : "elasticsearch_jwan",
"cluster_uuid" : "aAorzRYTQPOI0j_OgMGKpA",
"version" : {
"number" : "6.8.1",
"build_flavor" : "oss",
"build_type" : "tar",
"build_hash" : "1fad4e1",
"build_date" : "2019-06-18T13:16:52.517138Z",
"build_snapshot" : false,
"lucene_version" : "7.7.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
I am running ES in a terminal window and it works after I run the command elasticsearch
.
I am running a docker container with this command:
docker run -e DATALOADER_QUEUE='<some aws SQS queue name'\
-e ES_HOST='localhost'\
-e ES_PORT='9200'\
-e AWS_ACCESS_KEY_ID='<somekey>'\
-e AWS_SECRET_ACCESS_KEY='<somekey>'\
-e AWS_DEFAULT_REGION='us-west-2'\
<application name>
and I get this error:
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=9200): Max retries exceeded with url: /person/_search (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f36e4189c90>
Anyone know what is going on? I don't understand why it cannot connect to ES even though ti seems to be running on localhost:9200.