<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>

CC BY-SA 4.0
2024-08-29T07:40:25.157Z
On a Mac, it is at `~/Library/Group Containers/group.com.docker/settings.json`
mindlessgreen
CC BY-SA 4.0
2024-08-29T09:51:50.873Z
@mindlessgreen https://docs.docker.com/desktop/settings/mac/
YassineLbk
CC BY-SA 4.0
2024-08-29T13:02:37.803Z
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.
mindlessgreen
CC BY-SA 4.0
2024-08-28T21:59:56.063Z
2024-08-28T21:59:56.063Z
YassineLbk
<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>

<docker>
Increase swap memory in docker desktop
mindlessgreen
# 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

You can directly edit the %userprofile%\AppData\Roaming\Docker\settings.json file, for example, by setting "SwapMiB": 8192. After making changes, restart Docker.

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

> **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.  

---

