ubuntulinux.rst 4.3 KB

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