Created
March 31, 2021 07:52
-
-
Save johanforssell/2c839895def28a1982197931a7d527e9 to your computer and use it in GitHub Desktop.
Fixing error "Unable to lock JVM memory (ENOMEM)" in docker containers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Taken from https://www.youtube.com/watch?v=jgFzhhc7-e8 | |
TLDR; set `LimitMEMLOCK=infinity` for the docker deamon to trickle down to the containers. | |
--- | |
What's the PID of your Docker daemon? | |
> sudo service docker status | grep -P -o 'dockerd\[[0-9]+\]' | head -1 | grep -P -o [0-9]+ | |
Check the limits for that process | |
> cat /proc/`service docker status | grep -P -o 'dockerd\[[0-9]+\]' | head -1 | grep -P -o [0-9]+`/limits | |
The limit `Max locked memory` needs to be set to `UNLIMITED`. | |
Check which config file to change | |
> FILE=`sudo service docker status | grep 'Loaded: loaded (' | sed 's|[ ]*Loaded: loaded (||' | sed 's|;.*||'` | |
> vim $FILE | |
**Make sure you have a line with `LimitMEMLOCK=infinity` under the `[Service]` section.** | |
Restart the docker daemon | |
> sudo systemctl daemon-reload | |
> sudo service docker restart | |
Check the Memlock limit again. It should now be set to "infinity": | |
> cat /proc/`service docker status | grep -P -o 'dockerd\[[0-9]+\]' | head -1 | grep -P -o [0-9]+`/limits | |
You can also start your docker container, exec in to a shell and check the limit on a process there | |
> start docker container; exec to shell; cat /proc/1/limits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment