ubuntulinux.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 Linux
  6. ============
  7. .. include:: install_header.inc
  8. Right now, the officially supported distribution are:
  9. - :ref:`ubuntu_precise`
  10. - :ref:`ubuntu_raring`
  11. Docker has the following dependencies (read more in :ref:`kernel`):
  12. * Linux kernel 3.8
  13. * Device-mapper module
  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 device-mapper built
  26. in. We also include the generic headers to enable packages that depend
  27. on them, like ZFS and the VirtualBox guest additions. If you didn't
  28. install the headers for your "precise" kernel, then you can skip these
  29. headers for the "raring" kernel. But it is safer to include them if
  30. you're not 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. .. versionchanged:: v0.6
  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 easy.
  43. .. code-block:: bash
  44. # Add the Docker repository key to your local keychain
  45. # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
  46. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  47. # Add the Docker repository to your apt sources list.
  48. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  49. # Update your sources
  50. sudo apt-get update
  51. # Install, you will see another warning that the package cannot be authenticated. Confirm install.
  52. sudo apt-get install lxc-docker
  53. Verify it worked
  54. .. code-block:: bash
  55. # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell
  56. sudo docker run -i -t ubuntu /bin/bash
  57. # type 'exit' to exit
  58. **Done!**, now continue with the :ref:`hello_world` example.
  59. .. _ubuntu_raring:
  60. Ubuntu Raring 13.04 (64 bit)
  61. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  62. Dependencies
  63. ------------
  64. .. versionchanged:: v0.7
  65. Starting in 0.7 you no longer need to add support for AUFS.
  66. We now use the device-mapper module instead, and this module
  67. is included with kernels since kernel version 2.6
  68. Ubuntu Raring already comes with the 3.8 kernel, so we don't need to
  69. install it. However, not all systems have AUFS filesystem support
  70. enabled, so if you're on a Docker version before 0.7, then we need to
  71. install it.
  72. .. code-block:: bash
  73. # Only required for versions before v0.7
  74. sudo apt-get update
  75. sudo apt-get install linux-image-extra-`uname -r`
  76. Installation
  77. ------------
  78. Docker is available as a Debian package, which makes installation easy.
  79. *Please note that these instructions have changed for 0.6. If you are
  80. upgrading from an earlier version, you will need to follow them
  81. again.*
  82. .. code-block:: bash
  83. # Add the Docker repository key to your local keychain
  84. # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
  85. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  86. # Add the Docker repository to your apt sources list.
  87. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  88. # update
  89. sudo apt-get update
  90. # install
  91. sudo apt-get install lxc-docker
  92. Verify it worked
  93. .. code-block:: bash
  94. # download the base 'ubuntu' container
  95. # and run bash inside it while setting up an interactive shell
  96. sudo docker run -i -t ubuntu /bin/bash
  97. # type exit to exit
  98. **Done!**, now continue with the :ref:`hello_world` example.
  99. .. _ufw:
  100. Docker and UFW
  101. ^^^^^^^^^^^^^^
  102. Docker uses a bridge to manage container networking, and by default
  103. UFW drops all `forwarding`. A first step is to enable forwarding:
  104. .. code-block:: bash
  105. sudo nano /etc/default/ufw
  106. ----
  107. # Change:
  108. # DEFAULT_FORWARD_POLICY="DROP"
  109. # to
  110. DEFAULT_FORWARD_POLICY="ACCEPT"
  111. Then reload UFW:
  112. .. code-block:: bash
  113. sudo ufw reload