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

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

1 Like

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

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

1 Like

What is docker referring to?

I definitely have swap setup right:

But docker still says WARNING: No swap limit support!

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:
http://wiki.gentoo.org/wiki/LXC#General_Options

5 Likes

@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)?

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.

3 Likes

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

See explanation:

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.