ubuntulinux.rst 4.6 KB

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