AWS container service: set max_map_count

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:

  • Error unmounting Docker - invalid argument
  • Nagvis 404 error using Shinken in a Docker container
  • DigitalOcean, Docker, Dokku: Installing Firefox inside a container
  • how do I clean up /dev/mapper/docker and release space?
  • how to deploy .net core web api to linux machine
  • how could I add user permission parameter into docker-compose
  • $ 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

  • Container networking on between docker hosts on different VMs
  • docker mounts host's / directory to container's / in debian wheezy 7.8
  • Mongodb replicaset on gke not working
  • Requirement to accept network packets in container from host or outside? (docker port forwarding)
  • docker compose variable substitution
  • How to restore postgres within a docker?
  • 2 Solutions collect form web for “AWS container service: set max_map_count”

    You could still set it permanently in /etc/sysctl.conf as per you’ve mentioned in your Q. Didn’t it work?

    OR

    as per this ticket you could set it up as follows:

    sysctl -qw vm.max_map_count=65535

    Hope it helps!

    I found a solution:

    1. create an empty container
    2. Launch an EC2 inside the previous container: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html
    3. Add the user data (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html) as follow:
    #!/bin/bash
    echo vm.max_map_count=262144 >> /etc/sysctl.conf
    sysctl -w vm.max_map_count=262144
    

    Now the EC2 instance is properly configured.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.