ubuntulinux.rst 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. **These instructions have changed for 0.6. If you are upgrading from an earlier version, you will need to follow them again.**
  6. Ubuntu Linux
  7. ============
  8. **Please note this project is currently under heavy development. It should not be used in production.**
  9. Right now, the officially supported distribution are:
  10. - :ref:`ubuntu_precise`
  11. - :ref:`ubuntu_raring`
  12. Docker has the following dependencies
  13. * Linux kernel 3.8 (read more about :ref:`kernel`)
  14. * AUFS file system support (we are working on BTRFS support as an alternative)
  15. Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated 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 install when following these steps
  25. comes with AUFS built in. We also include the generic headers
  26. to enable packages that depend on them, like ZFS and the VirtualBox
  27. guest additions. If you didn't install the headers for your "precise"
  28. kernel, then you can skip these headers for the "raring" kernel. But
  29. it is safer to include them if you're not sure.
  30. .. code-block:: bash
  31. # install the backported kernel
  32. sudo apt-get update
  33. sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
  34. # reboot
  35. sudo reboot
  36. Installation
  37. ------------
  38. Docker is available as a Debian package, which makes installation easy.
  39. *Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
  40. to follow them again.*
  41. .. code-block:: bash
  42. # Add the Docker repository key to your local keychain
  43. sudo sh -c "curl https://get.docker.io/gpg | apt-key add -"
  44. # Add the Docker repository to your apt sources list.
  45. sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  46. # Update your sources
  47. sudo apt-get update
  48. # Install, you will see another warning that the package cannot be authenticated. Confirm install.
  49. sudo apt-get install lxc-docker
  50. Verify it worked
  51. .. code-block:: bash
  52. # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell
  53. sudo docker run -i -t ubuntu /bin/bash
  54. # type 'exit' to exit
  55. **Done!**, now continue with the :ref:`hello_world` example.
  56. .. _ubuntu_raring:
  57. Ubuntu Raring 13.04 (64 bit)
  58. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  59. Dependencies
  60. ------------
  61. **AUFS filesystem support**
  62. Ubuntu Raring already comes with the 3.8 kernel, so we don't need to install it. However, not all systems
  63. have AUFS filesystem support enabled, so we need to install it.
  64. .. code-block:: bash
  65. sudo apt-get update
  66. sudo apt-get install linux-image-extra-`uname -r`
  67. Installation
  68. ------------
  69. Docker is available as a Debian package, which makes installation easy.
  70. *Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
  71. to follow them again.*
  72. .. code-block:: bash
  73. # Add the Docker repository key to your local keychain
  74. sudo sh -c "curl http://get.docker.io/gpg | apt-key add -"
  75. # Add the Docker repository to your apt sources list.
  76. sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
  77. # update
  78. sudo apt-get update
  79. # install
  80. sudo apt-get install lxc-docker
  81. Verify it worked
  82. .. code-block:: bash
  83. # download the base 'ubuntu' container and run bash inside it while setting up an interactive shell
  84. sudo docker run -i -t ubuntu /bin/bash
  85. # type exit to exit
  86. **Done!**, now continue with the :ref:`hello_world` example.
  87. .. _ufw:
  88. Docker and UFW
  89. ^^^^^^^^^^^^^^
  90. Docker uses a bridge to manage containers networking, by default UFW drop all `forwarding`, a first step is to enable forwarding:
  91. .. code-block:: bash
  92. sudo nano /etc/default/ufw
  93. ----
  94. # Change:
  95. # DEFAULT_FORWARD_POLICY="DROP"
  96. # to
  97. DEFAULT_FORWARD_POLICY="ACCEPT"
  98. Then reload UFW:
  99. .. code-block:: bash
  100. sudo ufw reload
  101. UFW's default set of rules denied all `incoming`, so if you want to be able to reach your containers from another host,
  102. you should allow incoming connections on the docker port (default 4243):
  103. .. code-block:: bash
  104. sudo ufw allow 4243/tcp