ubuntulinux.rst 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. :title: Requirements and Installation on Ubuntu Linux
  2. :description: Please note this project is currently under heavy development. It should not be used in production.
  3. :keywords: Docker, Docker documentation, requirements, virtualbox, vagrant, git, ssh, putty, cygwin, linux
  4. .. _ubuntu_linux:
  5. Ubuntu
  6. ======
  7. .. warning::
  8. These instructions have changed for 0.6. If you are upgrading from
  9. an earlier version, you will need to follow them again.
  10. .. include:: install_header.inc
  11. Docker is supported on the following versions of Ubuntu:
  12. - :ref:`ubuntu_precise`
  13. - :ref:`ubuntu_raring`
  14. Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated
  15. Firewall) <https://help.ubuntu.com/community/UFW>`_
  16. .. _ubuntu_precise:
  17. Ubuntu Precise 12.04 (LTS) (64-bit)
  18. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  19. This installation path should work at all times.
  20. Dependencies
  21. ------------
  22. **Linux kernel 3.8**
  23. Due to a bug in LXC, docker works best on the 3.8 kernel. Precise
  24. comes with a 3.2 kernel, so we need to upgrade it. The kernel you'll
  25. install when following these steps comes with AUFS built in. We also
  26. include the generic headers to enable packages that depend on them,
  27. like ZFS and the VirtualBox guest additions. If you didn't install the
  28. headers for your "precise" kernel, then you can skip these headers for
  29. the "raring" kernel. But it is safer to include them if you're not
  30. sure.
  31. .. code-block:: bash
  32. # install the backported kernel
  33. sudo apt-get update
  34. sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
  35. # reboot
  36. sudo reboot
  37. Installation
  38. ------------
  39. .. warning::
  40. These instructions have changed for 0.6. If you are upgrading from
  41. an earlier version, you will need to follow them again.
  42. Docker is available as a Debian package, which makes installation
  43. easy. **See the :ref:`installmirrors` section below if you are not in
  44. the United States.** Other sources of the Debian packages may be
  45. faster for you to install.
  46. First add the Docker repository key to your local keychain. You can use the
  47. ``apt-key`` command to check the fingerprint matches: ``36A1 D786 9245 C895 0F96
  48. 6E92 D857 6A8B A88D 21E9``
  49. .. code-block:: bash
  50. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  51. Add the Docker repository to your apt sources list, update and install the
  52. ``lxc-docker`` package.
  53. *You may receive a warning that the package isn't trusted. Answer yes to
  54. continue installation.*
  55. .. code-block:: bash
  56. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
  57. > /etc/apt/sources.list.d/docker.list"
  58. sudo apt-get update
  59. sudo apt-get install lxc-docker
  60. .. note::
  61. There is also a simple ``curl`` script available to help with this process.
  62. .. code-block:: bash
  63. curl -s https://get.docker.io/ubuntu/ | sudo sh
  64. Now verify that the installation has worked by downloading the ``ubuntu`` image
  65. and launching a container.
  66. .. code-block:: bash
  67. sudo docker run -i -t ubuntu /bin/bash
  68. Type ``exit`` to exit
  69. **Done!**, now continue with the :ref:`hello_world` example.
  70. .. _ubuntu_raring:
  71. Ubuntu Raring 13.04 (64 bit)
  72. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  73. Dependencies
  74. ------------
  75. **Optional AUFS filesystem support**
  76. Ubuntu Raring already comes with the 3.8 kernel, so we don't need to install it. However, not all systems
  77. have AUFS filesystem support enabled. AUFS support is optional as of version 0.7, but it's still available as
  78. a driver and we recommend using it if you can.
  79. To make sure AUFS is installed, run the following commands:
  80. .. code-block:: bash
  81. sudo apt-get update
  82. sudo apt-get install linux-image-extra-`uname -r`
  83. Installation
  84. ------------
  85. Docker is available as a Debian package, which makes installation easy.
  86. .. warning::
  87. Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
  88. to follow them again.
  89. First add the Docker repository key to your local keychain. You can use the
  90. ``apt-key`` command to check the fingerprint matches: ``36A1 D786 9245 C895 0F96
  91. 6E92 D857 6A8B A88D 21E9``
  92. .. code-block:: bash
  93. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  94. Add the Docker repository to your apt sources list, update and install the
  95. ``lxc-docker`` package.
  96. .. code-block:: bash
  97. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
  98. > /etc/apt/sources.list.d/docker.list"
  99. sudo apt-get update
  100. sudo apt-get install lxc-docker
  101. Now verify that the installation has worked by downloading the ``ubuntu`` image
  102. and launching a container.
  103. .. code-block:: bash
  104. sudo docker run -i -t ubuntu /bin/bash
  105. Type ``exit`` to exit
  106. **Done!**, now continue with the :ref:`hello_world` example.
  107. .. _ufw:
  108. Docker and UFW
  109. ^^^^^^^^^^^^^^
  110. Docker uses a bridge to manage container networking. By default, UFW drops all
  111. `forwarding` traffic. As a result will you need to enable UFW forwarding:
  112. .. code-block:: bash
  113. sudo nano /etc/default/ufw
  114. ----
  115. # Change:
  116. # DEFAULT_FORWARD_POLICY="DROP"
  117. # to
  118. DEFAULT_FORWARD_POLICY="ACCEPT"
  119. Then reload UFW:
  120. .. code-block:: bash
  121. sudo ufw reload
  122. UFW's default set of rules denies all `incoming` traffic. If you want to be
  123. able to reach your containers from another host then you should allow
  124. incoming connections on the Docker port (default 4243):
  125. .. code-block:: bash
  126. sudo ufw allow 4243/tcp
  127. .. _installmirrors:
  128. Mirrors
  129. ^^^^^^^
  130. You should ``ping get.docker.io`` and compare the latency to the
  131. following mirrors, and pick whichever one is best for you.
  132. Yandex
  133. ------
  134. `Yandex <http://yandex.ru/>`_ in Russia is mirroring the Docker Debian
  135. packages, updating every 6 hours. Substitute
  136. ``http://mirror.yandex.ru/mirrors/docker/`` for
  137. ``http://get.docker.io/ubuntu`` in the instructions above. For example:
  138. .. code-block:: bash
  139. sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\
  140. > /etc/apt/sources.list.d/docker.list"
  141. sudo apt-get update
  142. sudo apt-get install lxc-docker