elasticsearch container started and then exited #460
-
Hi all, I'm trying to use elasticsearch for integration test:
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. But when I create docker-elasticsearch-test container with dotnet-testcontainers library then docker-elasticsearch-test container started and after 5-8 seconds exited. Also http://localhost:9200/ also doesn't work. Found these errors in logs: bootstrap check failure [1] of [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] bootstrap check failure [2] of [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured These errors most probably because elasticsearch not started in single node, i.e. I suspect .WithEnvironment("-e", ""discovery.type=single-node"") doesn't work. How can I fixed this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
#438 explains some best practices. See also this example regarding CosmosDB. I also wouldn't recommend synchronization methods like |
Beta Was this translation helpful? Give feedback.
-
Thank you! Your reply helped me to find the reason of problem, this is a working code:
|
Beta Was this translation helpful? Give feedback.
docker run
command.WithEnvironment
gets the name and value of the env variable like:WithEnvironment("discovery.type", "single-node")
#438 explains some best practices. See also this example regarding CosmosDB. I also wouldn't recommend synchronization methods like
Wait()
.