You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

max_map_count.md 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Set vm.max_map_count to at least 262144
  2. ## Linux
  3. To check the value of `vm.max_map_count`:
  4. ```bash
  5. $ sysctl vm.max_map_count
  6. ```
  7. Reset `vm.max_map_count` to a value at least 262144 if it is not.
  8. ```bash
  9. # In this case, we set it to 262144:
  10. $ sudo sysctl -w vm.max_map_count=262144
  11. ```
  12. This change will be reset after a system reboot. To ensure your change remains permanent, add or update the `vm.max_map_count` value in **/etc/sysctl.conf** accordingly:
  13. ```bash
  14. vm.max_map_count=262144
  15. ```
  16. ## Mac
  17. ```bash
  18. $ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
  19. $ sysctl -w vm.max_map_count=262144
  20. ```
  21. To exit the screen session, type Ctrl a d.
  22. ## Windows and macOS with Docker Desktop
  23. The vm.max_map_count setting must be set via docker-machine:
  24. ```bash
  25. $ docker-machine ssh
  26. $ sudo sysctl -w vm.max_map_count=262144
  27. ```
  28. ## Windows with Docker Desktop WSL 2 backend
  29. To manually set it every time you reboot, you must run the following commands in a command prompt or PowerShell window every time you restart Docker:
  30. ```bash
  31. $ wsl -d docker-desktop -u root
  32. $ sysctl -w vm.max_map_count=262144
  33. ```
  34. If you are on these versions of WSL and you do not want to have to run those commands every time you restart Docker, you can globally change every WSL distribution with this setting by modifying your %USERPROFILE%\.wslconfig as follows:
  35. ```bash
  36. [wsl2]
  37. kernelCommandLine = "sysctl.vm.max_map_count=262144"
  38. ```
  39. This will cause all WSL2 VMs to have that setting assigned when they start.
  40. If you are on Windows 11, or Windows 10 version 22H2 and have installed the Microsoft Store version of WSL, you can modify the /etc/sysctl.conf within the "docker-desktop" WSL distribution, perhaps with commands like this:
  41. ```bash
  42. $ wsl -d docker-desktop -u root
  43. $ vi /etc/sysctl.conf
  44. ```
  45. and appending a line which reads:
  46. ```bash
  47. vm.max_map_count = 262144
  48. ```