Your kernel does not support swap limit capabilities

One day I was trying to configure the Dockerized Kafka broker in my docker network.
There is a very good article that describes the way the Kafka listeners are working and can be found here https://rmoff.net/2018/08/02/kafka-listeners-explained/.

In order to make Kafka broker accessible from the external services, I adopted the recipe provided by the image provider here https://hub.docker.com/r/wurstmeister/kafka/ by utilizing the env var HOSTNAME_COMMAND. Docker responed me the following error

No swap limit support.

What does this error mean ?
After some search I founded that it means that the docker service is unable to enforce a limit on amount of swap that the processes running inside the container are using. Using swap allows the container to write excess memory requirements to disk when the container has exhausted all the RAM that is available to it.

Keep in mind that this kind of warnings may arise for other missing capabilities.

The steps for enable the swap capability ( in case you needed because it comes with a performance penalty ) are the following

1. Log into the Ubuntu or Debian host as a user with sudo privileges.
2. Edit the /etc/default/grub file. Add or edit the GRUB_CMDLINE_LINUX line to add the following two key-value pairs:
GRUB_CMDLINE_LINUX=”cgroup_enable=memory swapaccount=1″

3.update-grub

The changes take effect when the system is rebooted.

References :
https://docs.docker.com/engine/admin/resource_constraints

https://docs.docker.com/engine/installation/linux/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities