Search code examples
dockermemoryswap

How to increase Swap size on Docker for windows


I'm using Linux containers on Docker for windows.

Because of using gcc inside one of the containers I need to assign more than 4GB swap file to this container.

Previously, I used swapon to add more swap files but this stopped working with error:

swapon: failed operation not permitted

All I found is that it's not recommended to add own swap files to containers and only host swap file should be used.

But, in Docker for Windows, Swap file is limited to 4GB and I didn't find a way how to increase it:

https://i.ibb.co/pdTPdFt/Docker-Desktop-2020-02-20-18-21-07.png

Is there any command line or Docker-engine json param how to set it for example to 8GB?

Thanks


Solution

  • You can edit %userprofile%\AppData\Roaming\Docker\settings.json directly,
    like "SwapMiB": 8192.