kernel.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. :title: Kernel Requirements
  2. :description: Kernel supports
  3. :keywords: kernel requirements, kernel support, docker, installation, cgroups, namespaces
  4. .. _kernel:
  5. Kernel Requirements
  6. ===================
  7. In short, Docker has the following kernel requirements:
  8. - Linux version 3.8 or above.
  9. - Compiled with `AUFS support <http://aufs.sourceforge.net/>`_.
  10. - Cgroups and namespaces must be enabled.
  11. The officially supported kernel is the one recommended by the
  12. :ref:`ubuntu_linux` installation path. It is the one that most developers
  13. will use, and the one that receives the most attention from the core
  14. contributors. If you decide to go with a different kernel and hit a bug,
  15. please try to reproduce it with the official kernels first.
  16. If you cannot or do not want to use the "official" kernels,
  17. here is some technical background about the features (both optional and
  18. mandatory) that docker needs to run successfully.
  19. Namespaces and Cgroups
  20. ----------------------
  21. You need to enable namespaces and cgroups, to the extend of what is needed
  22. to run LXC containers. Technically, while namespaces have been introduced
  23. in the early 2.6 kernels, we do not advise to try any kernel before 2.6.32
  24. to run LXC containers. Note that 2.6.32 has some documented issues regarding
  25. network namespace setup and teardown; those issues are not a risk if you
  26. run containers in a private environment, but can lead to denial-of-service
  27. attacks if you want to run untrusted code in your containers. For more details,
  28. see `[LP#720095 <https://bugs.launchpad.net/ubuntu/+source/linux/+bug/720095>`_.
  29. Kernels 2.6.38, and every version since 3.2, have been deployed successfully
  30. to run containerized production workloads. Feature-wise, there is no huge
  31. improvement between 2.6.38 and up to 3.6 (as far as docker is concerned!).
  32. Important Note About Pre-3.8 Kernels
  33. ------------------------------------
  34. Kernel versions 3.2 to 3.5 are not stable when used with docker.
  35. In some circumstances, you will experience kernel "oopses", or even crashes.
  36. The symptoms include:
  37. - a container being killed in the middle of an operation (e.g. an ``apt-get``
  38. command doesn't complete);
  39. - kernel messages including mentioning calls to ``mntput`` or
  40. ``d_hash_and_lookup``;
  41. - kernel crash causing the machine to freeze for a few minutes, or even
  42. completely.
  43. While it is still possible to use older kernels for development, it is
  44. really not advised to do so.
  45. Docker checks the kernel version when it starts, and emits a warning if it
  46. detects something older than 3.8.
  47. See issue `#407 <https://github.com/dotcloud/docker/issues/407>`_ for details.
  48. Extra Cgroup Controllers
  49. ------------------------
  50. Most control groups can be enabled or disabled individually. For instance,
  51. you can decide that you do not want to compile support for the CPU or memory
  52. controller. In some cases, the feature can be enabled or disabled at boot
  53. time. It is worth mentioning that some distributions (like Debian) disable
  54. "expensive" features, like the memory controller, because they can have
  55. a significant performance impact.
  56. In the specific case of the memory cgroup, docker will detect if the cgroup
  57. is available or not. If it's not, it will print a warning, and it won't
  58. use the feature. If you want to enable that feature -- read on!
  59. Memory and Swap Accounting on Debian/Ubuntu
  60. -------------------------------------------
  61. If you use Debian or Ubuntu kernels, and want to enable memory and swap
  62. accounting, you must add the following command-line parameters to your kernel::
  63. cgroup_enable=memory swapaccount
  64. On Debian or Ubuntu systems, if you use the default GRUB bootloader, you can
  65. add those parameters by editing ``/etc/default/grub`` and extending
  66. ``GRUB_CMDLINE_LINUX``. Look for the following line::
  67. GRUB_CMDLINE_LINUX=""
  68. And replace it by the following one::
  69. GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount"
  70. Then run ``update-grub``, and reboot.
  71. AUFS
  72. ----
  73. Docker currently relies on AUFS, an unioning filesystem.
  74. While AUFS is included in the kernels built by the Debian and Ubuntu
  75. distributions, is not part of the standard kernel. This means that if
  76. you decide to roll your own kernel, you will have to patch your
  77. kernel tree to add AUFS. The process is documented on
  78. `AUFS webpage <http://aufs.sourceforge.net/>`_.