# Vm.max\_map\_count in Dockerfile

**URL:** <https://discuss.elastic.co/t/vm-max-map-count-in-dockerfile/94405>\
**Category:** Elasticsearch\
**Created:** [July 24, 2017, 11:44pm UTC](https://discuss.elastic.co/t/vm-max-map-count-in-dockerfile/94405 "2017-07-24T23:44:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rachelkelly](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rachelkelly](https://discuss.elastic.co/u/rachelkelly)\
**Post date:** [July 24, 2017, 11:44pm UTC](https://discuss.elastic.co/t/vm-max-map-count-in-dockerfile/94405/1 "2017-07-24T23:44:46Z")

</div>

Hello all, we are running Elasticsearch in a Docker container on an AWS EC2 instance in an ECS cluster using a Cloudformation template. AWS jargon aside, I can't find an automated way to add vm.max\_map\_count to the Cloudformation template. Please find [this ES discuss thread](https://discuss.elastic.co/t/elasticsearch-5-0-0-aplha4-wont-start-without-setting-vm-max-map-count/57471) which talks about some of the limitations for a little more background, though some pieces are Windows specific and apply as little as mac-specific tips do.

I would _like_ it to be part of a `RUN` layer in the Dockerfile since it is just a system-level command, but there is a note about it in the [official Elastic.co Dockerfile](https://github.com/docker-library/elasticsearch/blob/ea76a1f9e5589a1b9a9bcab1022df7953af81b87/5/Dockerfile#L35):

```auto
35: # don't allow the package to install its sysctl file (causes the install to fail)
36: # Failed to write '262144' to '/proc/sys/vm/max_map_count': Read-only file system

```

I THINK I've seen something that the above error is Mac-host-specific, probably to do with the fact that there is no `/proc/` on a mac.

If worse comes to worse, this can be a manual step on the AWS Linux image I'm creating, but I want to put it in as part of the build as it's entirely Elasticsearch-specific. My goal is halfway to submit a PR (is that possible or ever welcome? haha I do not know), or at least an Issue request, which includes `sysctl -w vm.max_map_count=262144` in a `RUN` layer in the Dockerfile, but I want to know why that's not possible, and if there's a way to automate Elasticsearch in a Docker container on an EC2 instance. FYI we cannot use AWS' elasticsearch service for compliance reasons.

Happy to include more info. Thank you in advance!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 21, 2017, 11:44pm UTC](https://discuss.elastic.co/t/vm-max-map-count-in-dockerfile/94405/2 "2017-08-21T23:44:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
