I had this faced this problem from an application running in a docker container.
Firstly no need to increase the virtual memory for Elasticsearch at the container level, just need to do it for the host machine by running following command:
sudo sysctl -w vm.max_map_count=262144
and after running this command just restart your docker-containers.
Setting this max_map_count this way will not persist upon the restart of the machine on which is running the docker container so you need to save it in a more persistent manner.