ubuntulinux.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. .. 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. Right now, the officially supported distribution are:
  12. - :ref:`ubuntu_precise`
  13. - :ref:`ubuntu_raring`
  14. Docker has the following dependencies
  15. * Linux kernel 3.8 (read more about :ref:`kernel`)
  16. * AUFS file system support (we are working on BTRFS support as an alternative)
  17. Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated
  18. Firewall) <https://help.ubuntu.com/community/UFW>`_
  19. .. _ubuntu_precise:
  20. Ubuntu Precise 12.04 (LTS) (64-bit)
  21. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  22. This installation path should work at all times.
  23. Dependencies
  24. ------------
  25. **Linux kernel 3.8**
  26. Due to a bug in LXC, docker works best on the 3.8 kernel. Precise
  27. comes with a 3.2 kernel, so we need to upgrade it. The kernel you'll
  28. install when following these steps comes with AUFS built in. We also
  29. include the generic headers to enable packages that depend on them,
  30. like ZFS and the VirtualBox guest additions. If you didn't install the
  31. headers for your "precise" kernel, then you can skip these headers for
  32. the "raring" kernel. But it is safer to include them if you're not
  33. sure.
  34. .. code-block:: bash
  35. # install the backported kernel
  36. sudo apt-get update
  37. sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
  38. # reboot
  39. sudo reboot
  40. Installation
  41. ------------
  42. .. warning::
  43. These instructions have changed for 0.6. If you are upgrading from
  44. an earlier version, you will need to follow them again.
  45. Docker is available as a Debian package, which makes installation easy.
  46. .. code-block:: bash
  47. # Add the Docker repository key to your local keychain
  48. # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
  49. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  50. # Add the Docker repository to your apt sources list.
  51. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
  52. > /etc/apt/sources.list.d/docker.list"
  53. # Update your sources
  54. sudo apt-get update
  55. # Install, you will see another warning that the package cannot be authenticated. Confirm install.
  56. sudo apt-get install lxc-docker
  57. Verify it worked
  58. .. code-block:: bash
  59. # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell
  60. sudo docker run -i -t ubuntu /bin/bash
  61. # type 'exit' to exit
  62. **Done!**, now continue with the :ref:`hello_world` example.
  63. .. _ubuntu_raring:
  64. Ubuntu Raring 13.04 (64 bit)
  65. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  66. Dependencies
  67. ------------
  68. **AUFS filesystem support**
  69. Ubuntu Raring already comes with the 3.8 kernel, so we don't need to install it. However, not all systems
  70. have AUFS filesystem support enabled, so we need to install it.
  71. .. code-block:: bash
  72. sudo apt-get update
  73. sudo apt-get install linux-image-extra-`uname -r`
  74. Installation
  75. ------------
  76. Docker is available as a Debian package, which makes installation easy.
  77. *Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
  78. to follow them again.*
  79. .. code-block:: bash
  80. # Add the Docker repository key to your local keychain
  81. # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
  82. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  83. # Add the Docker repository to your apt sources list.
  84. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
  85. > /etc/apt/sources.list.d/docker.list"
  86. # update
  87. sudo apt-get update
  88. # install
  89. sudo apt-get install lxc-docker
  90. Verify it worked
  91. .. code-block:: bash
  92. # download the base 'ubuntu' container
  93. # and run bash inside it while setting up an interactive shell
  94. sudo docker run -i -t ubuntu /bin/bash
  95. # type exit to exit
  96. **Done!**, now continue with the :ref:`hello_world` example.
  97. .. _ufw:
  98. Docker and UFW
  99. ^^^^^^^^^^^^^^
  100. Docker uses a bridge to manage container networking. By default, UFW
  101. drops all `forwarding`, thus a first step is to enable UFW forwarding:
  102. .. code-block:: bash
  103. sudo nano /etc/default/ufw
  104. ----
  105. # Change:
  106. # DEFAULT_FORWARD_POLICY="DROP"
  107. # to
  108. DEFAULT_FORWARD_POLICY="ACCEPT"
  109. Then reload UFW:
  110. .. code-block:: bash
  111. sudo ufw reload
  112. UFW's default set of rules denied all `incoming`, so if you want to be
  113. able to reach your containers from another host, you should allow
  114. incoming connections on the docker port (default 4243):
  115. .. code-block:: bash
  116. sudo ufw allow 4243/tcp