Increase virtual memory vm.max_map_count in boot2docker

I want to run Elasticsearch 5.0 with my Docker Toolbox. But it requires us to increase the vm.max_map_count to 262144 (https://www.elastic.co/guide/en/elasticsearch/reference/master/vm-max-map-count.html). I can do it by running these commands.

docker-machine ssh default
sysctl -w vm.max_map_count=262144
# Update the vm.max_map_count setting in /etc/sysctl.conf

setting check!.
cat /proc/sys/vm/max_map_count  

But they are reset after I re-boot my host. How to make boot2docker keeps these settings?

 

You can put it in vi /var/lib/boot2docker/bootlocal.sh

# Update the vm.max_map_count setting
sysctl -w vm.max_map_count=262144
chmod +x /var/lib/boot2docker/bootlocal.sh