2013-05-21 11:47:16 -06:00
|
|
|
:title: Requirements and Installation on Ubuntu Linux
|
|
|
|
:description: Please note this project is currently under heavy development. It should not be used in production.
|
|
|
|
:keywords: Docker, Docker documentation, requirements, virtualbox, vagrant, git, ssh, putty, cygwin, linux
|
|
|
|
|
2013-08-27 14:29:49 -07:00
|
|
|
.. _ubuntu_linux:
|
|
|
|
|
2013-11-26 00:16:30 -05:00
|
|
|
Ubuntu
|
|
|
|
======
|
2013-04-22 18:38:42 -07:00
|
|
|
|
2013-10-16 14:38:24 -07:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
These instructions have changed for 0.6. If you are upgrading from
|
|
|
|
an earlier version, you will need to follow them again.
|
|
|
|
|
2013-08-28 17:26:10 -07:00
|
|
|
.. include:: install_header.inc
|
2013-04-22 18:38:42 -07:00
|
|
|
|
2013-11-26 02:45:32 +00:00
|
|
|
Docker is supported on the following versions of Ubuntu:
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
- :ref:`ubuntu_precise`
|
|
|
|
- :ref:`ubuntu_raring`
|
|
|
|
|
2013-08-28 17:26:10 -07:00
|
|
|
Please read :ref:`ufw`, if you plan to use `UFW (Uncomplicated
|
|
|
|
Firewall) <https://help.ubuntu.com/community/UFW>`_
|
2013-07-30 13:47:29 +02:00
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
.. _ubuntu_precise:
|
|
|
|
|
|
|
|
Ubuntu Precise 12.04 (LTS) (64-bit)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
This installation path should work at all times.
|
2013-03-26 08:50:34 -07:00
|
|
|
|
2013-04-23 12:04:53 -07:00
|
|
|
|
|
|
|
Dependencies
|
|
|
|
------------
|
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
**Linux kernel 3.8**
|
|
|
|
|
2013-08-06 13:56:29 -07:00
|
|
|
Due to a bug in LXC, docker works best on the 3.8 kernel. Precise
|
2013-08-28 17:26:10 -07:00
|
|
|
comes with a 3.2 kernel, so we need to upgrade it. The kernel you'll
|
2013-10-16 14:38:24 -07:00
|
|
|
install when following these steps comes with AUFS built in. We also
|
|
|
|
include the generic headers to enable packages that depend on them,
|
|
|
|
like ZFS and the VirtualBox guest additions. If you didn't install the
|
|
|
|
headers for your "precise" kernel, then you can skip these headers for
|
|
|
|
the "raring" kernel. But it is safer to include them if you're not
|
|
|
|
sure.
|
2013-05-15 16:11:59 -07:00
|
|
|
|
2013-04-23 12:04:53 -07:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
# install the backported kernel
|
2013-08-06 13:56:29 -07:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
|
2013-05-15 16:11:59 -07:00
|
|
|
|
|
|
|
# reboot
|
|
|
|
sudo reboot
|
2013-04-23 12:04:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
2013-10-16 14:38:24 -07:00
|
|
|
.. warning::
|
|
|
|
|
2013-08-28 17:26:10 -07:00
|
|
|
These instructions have changed for 0.6. If you are upgrading from
|
|
|
|
an earlier version, you will need to follow them again.
|
|
|
|
|
2013-12-05 18:08:56 -08:00
|
|
|
Docker is available as a Debian package, which makes installation
|
|
|
|
easy. **See the :ref:`installmirrors` section below if you are not in
|
|
|
|
the United States.** Other sources of the Debian packages may be
|
|
|
|
faster for you to install.
|
2013-08-23 10:41:53 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
First add the Docker repository key to your local keychain. You can use the
|
|
|
|
``apt-key`` command to check the fingerprint matches: ``36A1 D786 9245 C895 0F96
|
|
|
|
6E92 D857 6A8B A88D 21E9``
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
.. code-block:: bash
|
2013-03-26 08:50:34 -07:00
|
|
|
|
2013-10-01 16:51:33 -06:00
|
|
|
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
|
2013-08-23 12:56:03 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Add the Docker repository to your apt sources list, update and install the
|
2013-12-11 11:27:36 -08:00
|
|
|
``lxc-docker`` package.
|
2013-11-26 00:58:17 -05:00
|
|
|
|
|
|
|
*You may receive a warning that the package isn't trusted. Answer yes to
|
|
|
|
continue installation.*
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-10-17 09:31:35 +02:00
|
|
|
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
|
|
|
|
> /etc/apt/sources.list.d/docker.list"
|
2013-05-15 16:11:59 -07:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install lxc-docker
|
|
|
|
|
2013-12-03 14:17:59 -05:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
There is also a simple ``curl`` script available to help with this process.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-12-11 11:27:36 -08:00
|
|
|
curl -s https://get.docker.io/ubuntu/ | sudo sh
|
2013-12-03 14:17:59 -05:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Now verify that the installation has worked by downloading the ``ubuntu`` image
|
|
|
|
and launching a container.
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-19 20:59:43 -07:00
|
|
|
.. code-block:: bash
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-08-13 18:05:35 -07:00
|
|
|
sudo docker run -i -t ubuntu /bin/bash
|
2013-05-15 16:11:59 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Type ``exit`` to exit
|
2013-05-15 16:11:59 -07:00
|
|
|
|
|
|
|
**Done!**, now continue with the :ref:`hello_world` example.
|
|
|
|
|
|
|
|
.. _ubuntu_raring:
|
|
|
|
|
|
|
|
Ubuntu Raring 13.04 (64 bit)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Dependencies
|
|
|
|
------------
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-11-26 02:45:32 +00:00
|
|
|
**Optional AUFS filesystem support**
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-10-16 14:38:24 -07:00
|
|
|
Ubuntu Raring already comes with the 3.8 kernel, so we don't need to install it. However, not all systems
|
2013-11-26 02:45:32 +00:00
|
|
|
have AUFS filesystem support enabled. AUFS support is optional as of version 0.7, but it's still available as
|
|
|
|
a driver and we recommend using it if you can.
|
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
To make sure AUFS is installed, run the following commands:
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-19 20:59:43 -07:00
|
|
|
.. code-block:: bash
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-19 20:59:43 -07:00
|
|
|
sudo apt-get update
|
2013-05-15 16:11:59 -07:00
|
|
|
sudo apt-get install linux-image-extra-`uname -r`
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-06-03 17:29:41 -04:00
|
|
|
|
2013-05-15 16:11:59 -07:00
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
2013-08-23 10:41:53 -07:00
|
|
|
Docker is available as a Debian package, which makes installation easy.
|
2013-05-15 16:11:59 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
Please note that these instructions have changed for 0.6. If you are upgrading from an earlier version, you will need
|
|
|
|
to follow them again.
|
|
|
|
|
|
|
|
First add the Docker repository key to your local keychain. You can use the
|
|
|
|
``apt-key`` command to check the fingerprint matches: ``36A1 D786 9245 C895 0F96
|
|
|
|
6E92 D857 6A8B A88D 21E9``
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-19 20:59:43 -07:00
|
|
|
.. code-block:: bash
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-10-01 16:51:33 -06:00
|
|
|
sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
|
2013-08-23 12:56:03 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Add the Docker repository to your apt sources list, update and install the
|
|
|
|
``lxc-docker`` package.
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2013-10-17 10:07:12 +02:00
|
|
|
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
|
|
|
|
> /etc/apt/sources.list.d/docker.list"
|
2013-05-15 16:11:59 -07:00
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install lxc-docker
|
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Now verify that the installation has worked by downloading the ``ubuntu`` image
|
|
|
|
and launching a container.
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-19 20:59:43 -07:00
|
|
|
.. code-block:: bash
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-08-13 18:05:35 -07:00
|
|
|
sudo docker run -i -t ubuntu /bin/bash
|
2013-05-15 16:11:59 -07:00
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Type ``exit`` to exit
|
2013-03-25 19:52:52 -07:00
|
|
|
|
2013-04-22 18:38:42 -07:00
|
|
|
**Done!**, now continue with the :ref:`hello_world` example.
|
2013-07-30 13:47:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
.. _ufw:
|
|
|
|
|
|
|
|
Docker and UFW
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
Docker uses a bridge to manage container networking. By default, UFW drops all
|
|
|
|
`forwarding` traffic. As a result will you need to enable UFW forwarding:
|
2013-07-30 13:47:29 +02:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
sudo nano /etc/default/ufw
|
|
|
|
----
|
|
|
|
# Change:
|
|
|
|
# DEFAULT_FORWARD_POLICY="DROP"
|
|
|
|
# to
|
|
|
|
DEFAULT_FORWARD_POLICY="ACCEPT"
|
|
|
|
|
|
|
|
Then reload UFW:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
sudo ufw reload
|
|
|
|
|
|
|
|
|
2013-11-26 00:58:17 -05:00
|
|
|
UFW's default set of rules denies all `incoming` traffic. If you want to be
|
|
|
|
able to reach your containers from another host then you should allow
|
|
|
|
incoming connections on the Docker port (default 4243):
|
2013-10-16 14:38:24 -07:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
sudo ufw allow 4243/tcp
|
|
|
|
|
2013-12-05 18:08:56 -08:00
|
|
|
.. _installmirrors:
|
|
|
|
|
|
|
|
Mirrors
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
You should ``ping get.docker.io`` and compare the latency to the
|
|
|
|
following mirrors, and pick whichever one is best for you.
|
|
|
|
|
|
|
|
Yandex
|
|
|
|
------
|
|
|
|
|
|
|
|
`Yandex <http://yandex.ru/>`_ in Russia is mirroring the Docker Debian
|
|
|
|
packages, updating every 6 hours. Substitute
|
|
|
|
``http://mirror.yandex.ru/mirrors/docker/`` for
|
|
|
|
``http://get.docker.io/ubuntu`` in the instructions above. For example:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\
|
|
|
|
> /etc/apt/sources.list.d/docker.list"
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install lxc-docker
|