# Why does Docker say "WARNING: No swap limit support!"

**URL:** https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945
**Category:** Self-hosting
**Tags:** server-resources
**Created:** [2015年六月12日 20:47 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945 "2015-06-12T20:47:09Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![nahtnam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nahtnam/32/122073_2.png) [@nahtnam](https://meta.discourse.org/u/nahtnam)
#### Post date: [2014年七月14日 16:06 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/1 "2014-07-14T16:06:24Z")

</div>

Is it weird that even after completing the tutorial, Docker says that there is no swap file detected?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2014年七月14日 20:05 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/2 "2014-07-14T20:05:10Z")

</div>

I am not sure Docker is talking about what you think it is. Check the OS level indicators with `free -m`:

2GB Digital Ocean instance (with 1GB swap for safety)

```
             total used free shared buffers cached
Mem: 2002 1748 254 0 121 575
-/+ buffers/cache: 1051 951
Swap: 1023 43 980

```

2GB Digital Ocean instance (no swap)

```
             total used free shared buffers cached
Mem: 2002 1814 188 0 273 627
-/+ buffers/cache: 914 1088
Swap: 0 0 0

```

---

<div class="post-metadata">

### Author: ![tuananh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tuananh/32/33428_2.png) [@tuananh](https://meta.discourse.org/u/tuananh)
#### Post date: [2014年七月15日 01:38 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/3 "2014-07-15T01:38:02Z")

</div>

and also, CPU resource on cheap VPS is kinda of a luxury thing so just swap for now to be safe.

---

<div class="post-metadata">

### Author: ![nahtnam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nahtnam/32/122073_2.png) [@nahtnam](https://meta.discourse.org/u/nahtnam)
#### Post date: [2014年七月15日 04:15 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/4 "2014-07-15T04:15:07Z")

</div>

Docker 指的是什么？

我的交换空间（swap）配置肯定正确：  
 ![16048e5fa8](https://global.discourse-cdn.com/meta/original/4X/a/b/c/abcecd6cf29e7d84f8cc1dc6a7b764d308dbac89.png)  
但 Docker 仍然提示「WARNING: No swap limit support」！

---

<div class="post-metadata">

### Author: ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)
#### Post date: [2014年七月15日 04:22 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/5 "2014-07-15T04:22:10Z")

</div>

It means that it is unable to enforce a limit on amount of swap that the processes running inside the container are using. Either your kernel was compiled with the necessary cgroup (kernel options `CGROUP_FREEZER` and `MEMCG_SWAP`, I believe) or it requires a command line option at boot to enable this feature.

In short, this has nothing to do with the presence of swap space and unless you’re hosting competing containers and must assure available private memory and swap you can safely disregard the message.

Edit: Gentoo has a HOWTO on setting up LXC containers; since Docker is a fancy frontend for LXC, the kernel configuration part of that HOWTO might be helpful:

> **[LXC - Gentoo wiki](https://wiki.gentoo.org/wiki/LXC)**

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [2014年七月15日 05:14 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/6 "2014-07-15T05:14:49Z")

</div>

@sam how about changing this message to “No swap _quota_ support” - not exactly correct, but more likely to leave a correct first impression (i.e. that it’s a nice-to-have)?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2014年七月15日 05:20 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/7 "2014-07-15T05:20:24Z")

</div>

It’s not coming from us, we would need to pipe STDERR and process it to fix that, better approach is raising a ticket with Docker to improve the message.

---

<div class="post-metadata">

### Author: ![krauss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/krauss/32/221613_2.png) [@krauss](https://meta.discourse.org/u/krauss)
#### Post date: [2017年七月27日 09:30 UTC](https://meta.discourse.org/t/why-does-docker-say-warning-no-swap-limit-support/29945/8 "2017-07-27T09:30:19Z")

</div>

I have the same message, and same `Swap: 0 0 0` today, 2017… It is fine!

See [explanation](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04):

> Although swap is generally recommended for systems utilizing traditional spinning hard drives, using **swap with SSDs can cause issues with hardware degradation over time**. Due to this consideration, we **do not recommend enabling swap** on DigitalOcean or any other provider that utilizes **SSD** storage. Doing so can impact the reliability of the underlying hardware for you and your neighbors. This guide is provided as reference for users who may have spinning disk systems elsewhere.
