ubuntulinux.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 > /etc/apt/sources.list.d/docker.list"
  52. # Update your sources
  53. sudo apt-get update
  54. # Install, you will see another warning that the package cannot be authenticated. Confirm install.
  55. sudo apt-get install lxc-docker
  56. Verify it worked
  57. .. code-block:: bash
  58. # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell
  59. sudo docker run -i -t ubuntu /bin/bash
  60. # type 'exit' to exit
  61. **Done!**, now continue with the :ref:`hello_world` example.
  62. .. _ubuntu_raring:
  63. Ubuntu Raring 13.04 (64 bit)
  64. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  65. Dependencies
  66. ------------
  67. **AUFS filesystem support**
  68. Ubuntu Raring already comes with the 3.8 kernel, so we don't need to install it. However, not all systems
  69. have AUFS filesystem support enabled, so we need to install it.
  70. .. code-block:: bash
  71. sudo apt-get update
  72. sudo apt-get install linux-image-extra-`uname -r`
  73. Installation
  74. ------------
  75. Docker is available as a Debian package, which makes installation easy.
  76. *Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
  77. to follow them again.*
  78. .. code-block:: bash
  79. # Add the Docker repository key to your local keychain
  80. # using apt-key finger you can check the fingerprint matches 36A1 D786 9245 C895 0F96 6E92 D857 6A8B A88D 21E9
  81. sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
  82. # Add the Docker repository to your apt sources list.
  83. sudo sh -c "echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  84. # update
  85. sudo apt-get update
  86. # install
  87. sudo apt-get install lxc-docker
  88. Verify it worked
  89. .. code-block:: bash
  90. # download the base 'ubuntu' container
  91. # and run bash inside it while setting up an interactive shell
  92. sudo docker run -i -t ubuntu /bin/bash
  93. # type exit to exit
  94. **Done!**, now continue with the :ref:`hello_world` example.
  95. .. _ufw:
  96. Docker and UFW
  97. ^^^^^^^^^^^^^^
  98. Docker uses a bridge to manage containers networking, by default UFW
  99. drop all `forwarding`, a first step is to enable forwarding:
  100. .. code-block:: bash
  101. sudo nano /etc/default/ufw
  102. ----
  103. # Change:
  104. # DEFAULT_FORWARD_POLICY="DROP"
  105. # to
  106. DEFAULT_FORWARD_POLICY="ACCEPT"
  107. Then reload UFW:
  108. .. code-block:: bash
  109. sudo ufw reload
  110. UFW's default set of rules denied all `incoming`, so if you want to be
  111. able to reach your containers from another host, you should allow
  112. incoming connections on the docker port (default 4243):
  113. .. code-block:: bash
  114. sudo ufw allow 4243/tcp