Skip to content

elasticsearch container started and then exited #460

Answered by HofmeisterAn
Korrozia asked this question in Q&A
Discussion options

You must be logged in to vote

I tried this command: docker run -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.3, and it is working correct.

  1. Your builder configuration does not match the docker run command.
  2. You don't expose and bind the ports (that's necessary to access your service via HTTP).
  3. WithEnvironment gets the name and value of the env variable like: WithEnvironment("discovery.type", "single-node")
  4. Probably, you'll need a custom wait strategy to detect when the container is up and running.

#438 explains some best practices. See also this example regarding CosmosDB. I also wouldn't recommend synchronization methods like Wait().

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by HofmeisterAn
Comment options

You must be logged in to vote
1 reply
@HofmeisterAn
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants