Answers: <ol>
  <li><p>You can directly edit the <code>%userprofile%\AppData\Roaming\Docker\settings.json</code> file, for example, by setting <code>&quot;SwapMiB&quot;: 8192</code>. After making changes, restart Docker.</p>
  </li>
  <li><p>If you installed Docker with the <code>WSL 2</code> backend (the default option), you need to create a <code>.wslconfig</code> file in your user directory. The file should have the following structure:</p>
  </li>
  </ol>
  <pre><code>[wsl2]
  memory=19GB # Limits VM memory in WSL 2
  swap=110GB
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/60325478/how-to-increase-swap-size-on-docker-for-windows">Source</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2024-08-29T07:40:25.157Z
Answers: On a Mac, it is at `~/Library/Group Containers/group.com.docker/settings.json`
Answers: mindlessgreen
Answers: CC BY-SA 4.0
Answers: 2024-08-29T09:51:50.873Z
Answers: @mindlessgreen https://docs.docker.com/desktop/settings/mac/
Answers: YassineLbk
Answers: CC BY-SA 4.0
Answers: 2024-08-29T13:02:37.803Z
Answers: After updating the settings.json and restarting docker, I see that the container still crashes as soon as it exceeds physically available RAM. So it doesn't seem like it's using the specified swap memory.
Answers: mindlessgreen
Answers: CC BY-SA 4.0
Answers: 2024-08-28T21:59:56.063Z
Answers: 2024-08-28T21:59:56.063Z
Answers: YassineLbk
Body: <p>Swap memory is limited to 4GB. How do I increase this?</p>
  <p><a href="https://i.sstatic.net/TM3IAUsJ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TM3IAUsJ.jpg" alt="enter image description here" /></a></p>
  <p><a href="https://i.sstatic.net/Z4xl7htm.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Z4xl7htm.jpg" alt="enter image description here" /></a></p>
  
Tags: <docker>
Title: Increase swap memory in docker desktop
UserDisplayName: mindlessgreen
ThreadText: # Increase swap memory in docker desktop
  
  (Asked by: username_0 on 2024-08-28)
  
  Swap memory is limited to 4GB. How do I increase this?
  
  [![enter image description here](https://i.sstatic.net/TM3IAUsJ.jpg)](https://i.sstatic.net/TM3IAUsJ.jpg)
  
  [![enter image description here](https://i.sstatic.net/Z4xl7htm.jpg)](https://i.sstatic.net/Z4xl7htm.jpg)
  
  **Tags:** docker
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-08-28. Score: 2
  
  1. You can directly edit the `%userprofile%\AppData\Roaming\Docker\settings.json` file, for example, by setting `"SwapMiB": 8192`. After making changes, restart Docker.
  2. If you installed Docker with the `WSL 2` backend (the default option), you need to create a `.wslconfig` file in your user directory. The file should have the following structure:
  
  ```
  [wsl2]
  memory=19GB # Limits VM memory in WSL 2
  swap=110GB
  
  ```
  
  [Source](https://stackoverflow.com/questions/60325478/how-to-increase-swap-size-on-docker-for-windows)
  
  > **Comments:**
  > **username_0**: On a Mac, it is at `~/Library/Group Containers/group.com.docker/settings.json`  
  > **username_1**: @username_0 https://docs.docker.com/desktop/settings/mac/  
  > **username_0**: After updating the settings.json and restarting docker, I see that the container still crashes as soon as it exceeds physically available RAM. So it doesn't seem like it's using the specified swap memory.  
  
  ---
  
  