Prevent swap in docker container

Hello,
How can I prevent ElasticSearch 1.7 from swapping when running inside a docker container?

I am running the container with the -memory-swap=-1 flag, and still seeing around 500 MB of swapping.
Is this normal?

Also tried to add bootstrap.mlockall: true to the elasticsearch.yml file, but then got the message:
Unable to lock JVM memory (ENOMEM). This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit).

Is there any documented way to achieve this?

Thanks.

https://www.elastic.co/guide/en/elasticsearch/reference/1.7/setup-configuration.html should help.

Thanks.
There are 3 ways to achieve this, two of them require a system-wide change which I am currently not able to do.
Is there any way to do this from within a Docker container without affecting the whole server, and succeed?

Self-Answer:
I was using the wrong docker run flag.
To prevent swapping, you should use something like --memory-swappiness=0 --memory 40G --memory-swap 40G.
By stating the memory is X and memory+swap is X, you prevent swapping.