Question:
I’m trying to run Elasticsearch on AWS container service. Here the documentation that I’m following: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode
The vm_map_max_count setting should be set permanently in
/etc/sysctl.conf:$ grep vm.max_map_count /etc/sysctl.conf
vm.max_map_count=262144
To apply the setting on a live system type: sysctl -w
vm.max_map_count=262144
Is there any way to set the vm.max_map_count via script? I don’t want to do it manually every time I run a new container.
Thanks
Answer:
I found a solution:
- create an empty container
- Launch an EC2 inside the previous container: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html
- Add the user data (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) as follow:
1234 #!/bin/bashecho vm.max_map_count=262144 >> /etc/sysctl.confsysctl -w vm.max_map_count=262144
Now the EC2 instance is properly configured.