# This is a combination of 2 commits.

# The first commit's message is:

Updating Ubuntu installation to use wget; eliminating elo

Signed-off-by: Mary Anthony <mary.anthony@docker.com>

# This is the 2nd commit message:

Adding in James comments

Signed-off-by: Mary Anthony <mary@docker.com>
This commit is contained in:
Mary Anthony 2015-03-12 15:23:56 -07:00 коммит произвёл Mary Anthony
Родитель ed66853697
Коммит f60ed98e79
2 изменённых файлов: 198 добавлений и 287 удалений

Просмотреть файл

@ -31,24 +31,24 @@ pages:
# Installation:
- ['installation/index.md', '**HIDDEN**']
- ['installation/mac.md', 'Installation', 'Mac OS X']
- ['installation/ubuntulinux.md', 'Installation', 'Ubuntu']
- ['installation/mac.md', 'Installation', 'Mac OS X']
- ['installation/windows.md', 'Installation', 'Microsoft Windows']
- ['installation/amazon.md', 'Installation', 'Amazon EC2']
- ['installation/archlinux.md', 'Installation', 'Arch Linux']
- ['installation/binaries.md', 'Installation', 'Binaries']
- ['installation/centos.md', 'Installation', 'CentOS']
- ['installation/cruxlinux.md', 'Installation', 'CRUX Linux']
- ['installation/debian.md', 'Installation', 'Debian']
- ['installation/fedora.md', 'Installation', 'Fedora']
- ['installation/frugalware.md', 'Installation', 'FrugalWare']
- ['installation/google.md', 'Installation', 'Google Cloud Platform']
- ['installation/gentoolinux.md', 'Installation', 'Gentoo']
- ['installation/softlayer.md', 'Installation', 'IBM Softlayer']
- ['installation/rackspace.md', 'Installation', 'Rackspace Cloud']
- ['installation/rhel.md', 'Installation', 'Red Hat Enterprise Linux']
- ['installation/oracle.md', 'Installation', 'Oracle Linux']
- ['installation/centos.md', 'Installation', 'CentOS']
- ['installation/debian.md', 'Installation', 'Debian']
- ['installation/gentoolinux.md', 'Installation', 'Gentoo']
- ['installation/google.md', 'Installation', 'Google Cloud Platform']
- ['installation/rackspace.md', 'Installation', 'Rackspace Cloud']
- ['installation/amazon.md', 'Installation', 'Amazon EC2']
- ['installation/softlayer.md', 'Installation', 'IBM Softlayer']
- ['installation/archlinux.md', 'Installation', 'Arch Linux']
- ['installation/frugalware.md', 'Installation', 'FrugalWare']
- ['installation/fedora.md', 'Installation', 'Fedora']
- ['installation/SUSE.md', 'Installation', 'SUSE']
- ['installation/cruxlinux.md', 'Installation', 'CRUX Linux']
- ['installation/windows.md', 'Installation', 'Microsoft Windows']
- ['installation/binaries.md', 'Installation', 'Binaries']
- ['compose/install.md', 'Installation', 'Docker Compose']
# User Guide:
@ -187,3 +187,4 @@ pages:
- ['project/get-help.md', 'Contributor Guide', 'Where to get help']
- ['project/coding-style.md', 'Contributor Guide', 'Coding style guide']
- ['project/doc-style.md', 'Contributor Guide', 'Documentation style guide']

Просмотреть файл

@ -2,394 +2,304 @@ page_title: Installation on Ubuntu
page_description: Instructions for installing Docker on Ubuntu.
page_keywords: Docker, Docker documentation, requirements, virtualbox, installation, ubuntu
# Ubuntu
#Ubuntu
Docker is supported on the following versions of Ubuntu:
Docker is supported on these Ubuntu operating systems:
- [*Ubuntu Trusty 14.04 (LTS) (64-bit)*](#ubuntu-trusty-1404-lts-64-bit)
- [*Ubuntu Precise 12.04 (LTS) (64-bit)*](#ubuntu-precise-1204-lts-64-bit)
- [*Ubuntu Raring 13.04 and Saucy 13.10 (64
bit)*](#ubuntu-raring-1304-and-saucy-1310-64-bit)
- Ubuntu Trusty 14.04 (LTS)
- Ubuntu Precise 12.04 (LTS)
- Ubuntu Saucy 13.10
Please read [*Docker and UFW*](#docker-and-ufw), if you plan to use [UFW
(Uncomplicated Firewall)](https://help.ubuntu.com/community/UFW)
This page instructs you to install using Docker-managed release packages and
installation mechanisms. Using these packages ensures you get the latest release
of Docker. If you wish to install using Ubuntu-managed packages, consult your
Ubuntu documentation.
## Ubuntu Trusty 14.04 (LTS) (64-bit)
##Prerequisites
Ubuntu Trusty comes with a 3.13.0 Linux kernel, and a `docker.io` package which
installs Docker 1.0.1 and all its prerequisites from Ubuntu's repository.
Docker requires a 64-bit installation regardless of your Ubuntu version.
Additionally, your kernel must be 3.10 at minimum. The latest 3.10 minor version
or a newer maintained version are also acceptable.
> **Note**:
> Ubuntu (and Debian) contain a much older KDE3/GNOME2 package called ``docker``, so the
> Ubuntu-maintained package and executable are named ``docker.io``.
Kernels older than 3.10 lack some of the features required to run Docker
containers. These older versions are known to have bugs which cause data loss
and frequently panic under certain conditions.
### Ubuntu-maintained Package Installation
To check your current kernel version, open a terminal and use `uname -r` to display
your kernel version:
To install the latest Ubuntu package (this is **not** the most recent Docker release):
$ uname -r
3.11.0-15-generic
>**Caution** Some Ubuntu OS versions **require a version higher than 3.10** to
>run Docker, see the prerequisites on this page that apply to your Ubuntu
>version.
###For Trusty 14.04
There are no prerequisites for this version.
###For Precise 12.04 (LTS)
For Ubuntu Precise, Docker requires the 3.13 kernel version. If your kernel
version is older than 3.13, you must upgrade it. Refer to this table to see
which packages are required for your environment:
<style type="text/css"> .tg {border-collapse:collapse;border-spacing:0;} .tg
td{font-size:14px;padding:10px
5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg-031{width:275px;font-family:monospace} </style> <table class="tg"> <tr> <td
class="tg-031">linux-image-generic-lts-trusty</td> <td class="tg-031e">Generic
Linux kernel image. This kernel has AUFS built in. This is required to run
Docker.</td> </tr> <tr> <td class="tg-031">linux-headers-generic-lts-trusty</td>
<td class="tg-031e">Allows packages such as ZFS and VirtualBox guest additions
which depend on them. If you didn't install the headers for your existing
kernel, then you can skip these headers for the"trusty" kernel. If you're
unsure, you should include this package for safety.</td> </tr> <tr> <td
class="tg-031">xserver-xorg-lts-trusty</td> <td class="tg-031e"
rowspan="2">Optional in non-graphical environments without Unity/Xorg.
<i>Required</i> when running Docker on machine with a graphical environment.
<p>To learn more about the reasons for these packages, read the installation
instructions for backported kernels, specifically the <a
href="https://wiki.ubuntu.com/Kernel/LTSEnablementStack" target="_blank">LTS
Enablement Stack</a> &mdash; refer to note 5 under each version.</p></td> </tr>
<tr> <td class="tg-031">libgl1-mesa-glx-lts-trusty</td> </tr> </table> &nbsp;
To upgrade your kernel and install the additional packages, do the following:
1. Open a terminal on your Ubuntu host.
2. Update your package manager.
$ sudo apt-get update
$ sudo apt-get install docker.io
Then, to enable tab-completion of Docker commands in BASH, either restart BASH or:
3. Install both the required and optional packages.
$ source /etc/bash_completion.d/docker*
$ sudo apt-get install linux-image-generic-lts-trusty
> **Note**:
> Since the Ubuntu package is quite dated at this point, you may want to use
> the following section to install the most recent release of Docker.
> If you install the Docker version, you do not need to install ``docker.io`` from Ubuntu.
Depending on your environment, you may install more as described in the preceding table.
### Docker-maintained Package Installation
4. Reboot your host.
If you'd like to try the latest version of Docker:
First, check that your APT system can deal with `https`
URLs: the file `/usr/lib/apt/methods/https`
should exist. If it doesn't, you need to install the package
`apt-transport-https`.
[ -e /usr/lib/apt/methods/https ] || {
apt-get update
apt-get install apt-transport-https
}
Then, add the Docker repository key to your local keychain.
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
Add the Docker repository to your apt sources list, update and install
the `lxc-docker` package.
*You may receive a warning that the package isn't trusted. Answer yes to
continue installation.*
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
> **Note**:
>
> There is also a simple `curl` script available to help with this process.
>
> $ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
To verify that everything has worked as expected:
$ sudo docker run -i -t ubuntu /bin/bash
Which should download the `ubuntu` image, and then start `bash` in a container.
Type `exit` to exit
**Done!**, continue with the [User Guide](/userguide/).
## Ubuntu Precise 12.04 (LTS) (64-bit)
This installation path should work at all times.
### Dependencies
**Linux kernel 3.13**
For Ubuntu Precise, the currently recommended kernel version is 3.13.
Ubuntu Precise installations with older kernels must be upgraded. The
kernel you'll install when following these steps has 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
"trusty" kernel. If you're unsure, you should include the headers for safety.
> **Warning**:
> Kernels 3.8 and 3.11 are no longer supported by Canonical. Systems
> running these kernels need to be updated using the instructions below.
> Running Docker on these unsupported systems isn't supported either.
> These old kernels are no longer patched for security vulnerabilities
> and severe bugs which lead to data loss.
Please read the installation instructions for backported kernels at
Ubuntu.org to understand why you also need to install the Xorg packages
when running Docker on a machine with a graphical environment like Unity.
[LTS Enablement Stack](https://wiki.ubuntu.com/Kernel/LTSEnablementStack) refer to note 5 under
each version.
# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty
# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-trusty xserver-xorg-lts-trusty libgl1-mesa-glx-lts-trusty
# reboot
$ sudo reboot
### Installation
5. After your system reboots, go ahead and [install Docker](#installing-docker-on-ubuntu).
> **Warning**:
> These instructions have changed for 0.6. If you are upgrading from an
> earlier version, you will need to follow them again.
Docker is available as a Debian package, which makes installation easy.
**See the** [*Mirrors*](#mirrors) **section below if you are not
in the United States.** Other sources of the Debian packages may be
faster for you to install.
###For Saucy 13.10 (64 bit)
First, check that your APT system can deal with `https`
URLs: the file `/usr/lib/apt/methods/https`
should exist. If it doesn't, you need to install the package
`apt-transport-https`.
Docker uses AUFS as the default storage backend. If you don't have this
prerequisite installed, Docker's installation process adds it.
[ -e /usr/lib/apt/methods/https ] || {
apt-get update
apt-get install apt-transport-https
}
##Installing Docker on Ubuntu
Then, add the Docker repository key to your local keychain.
Make sure you have intalled the prerequisites for your Ubuntu version. Then,
install Docker using the following:
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
1. Log into your Ubuntu installation as a user with `sudo` privileges.
Add the Docker repository to your apt sources list, update and install
the `lxc-docker` package.
2. Verify that you have `wget` installed.
*You may receive a warning that the package isn't trusted. Answer yes to
continue installation.*
$ which wget
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
If `wget` isn't installed, install it after updating your manager:
> **Note**:
>
> There is also a simple `curl` script available to help with this process.
>
> $ curl -sSL https://get.docker.com/ubuntu/ | sudo sh
$ sudo apt-get update $ sudo apt-get install wget
Now verify that the installation has worked by downloading the
`ubuntu` image and launching a container.
3. Get the latest Docker package.
$ sudo docker run -i -t ubuntu /bin/bash
$ wget -qO- https://get.docker.com/ | sh
Type `exit` to exit
The system prompts you for your `sudo` password. Then, it downloads and
installs Docker and its dependencies.
**Done!**, continue with the [User Guide](/userguide/).
4. Verify `docker` is installed correctly.
## Ubuntu Raring 13.04 and Saucy 13.10 (64 bit)
$ sudo docker run hello-world
These instructions cover both Ubuntu Raring 13.04 and Saucy 13.10.
This command downloads a test image and runs it in a container.
### Dependencies
## Optional Configurations for Docker on Ubuntu
**Optional AUFS filesystem support**
This section contains optional procedures for configuring your Ubuntu to work
better with Docker.
Ubuntu Raring already comes with the 3.8 kernel, so we don't need to
install it. However, not all systems 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.
* [Create a docker group](#create-a-docker-group)
* [Adjust memory and swap accounting](#adjust-memory-and-swap-accounting)
* [Enable UFW forwarding](#enable-ufw-forwarding)
* [Configure a DNS server for use by Docker](#configure-a-dns-server-for-docker)
To make sure AUFS is installed, run the following commands:
### Create a docker group
$ sudo apt-get update
$ sudo apt-get install linux-image-extra-`uname -r`
The `docker` daemon binds to a Unix socket instead of a TCP port. By default
that Unix socket is owned by the user `root` and other users can access it with
`sudo`. For this reason, `docker` daemon always runs as the `root` user.
### Installation
To avoid having to use `sudo` when you use the `docker` command, create a Unix
group called `docker` and add users to it. When the `docker` daemon starts, it
makes the ownership of the Unix socket read/writable by the `docker` group.
Docker is available as a Debian package, which makes installation easy.
>**Warning**: The `docker` group is equivalent to the `root` user; For details
>on how this impacts security in your system, see [*Docker Daemon Attack
>Surface*](/articles/security/#docker-daemon-attack-surface) for details.
> **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.
To create the `docker` group and add your user:
First add the Docker repository key to your local keychain.
1. Log into Ubuntu as a user with `sudo` privileges.
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
This procedure assumes you log in as the `ubuntu` user.
Add the Docker repository to your apt sources list, update and install
the `lxc-docker` package.
3. Create the `docker` group and add your user.
$ sudo sh -c "echo deb http://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
$ sudo usermod -aG docker ubuntu
Now verify that the installation has worked by downloading the
`ubuntu` image and launching a container.
3. Log out and log back in.
$ sudo docker run -i -t ubuntu /bin/bash
This ensures your user is running with the correct permissions.
Type `exit` to exit
4. Verify your work by running `docker` without `sudo`.
**Done!**, now continue with the [User Guide](/userguide/).
$ docker run hello-world
### Upgrade
To install the latest version of Docker, use the standard
`apt-get` method:
### Adjust memory and swap accounting
# update your sources list
$ sudo apt-get update
When users run Docker, they may see these messages when working with an image:
# install the latest
$ sudo apt-get install lxc-docker
WARNING: Your kernel does not support cgroup swap limit. WARNING: Your
kernel does not support swap limit capabilities. Limitation discarded.
## Giving non-root access
To prevent these messages, enable memory and swap accounting on your system. To
enable these on system using GNU GRUB (GNU GRand Unified Bootloader), do the
following.
The `docker` daemon always runs as the `root` user, and since Docker
version 0.5.2, the `docker` daemon binds to a Unix socket instead of a
TCP port. By default that Unix socket is owned by the user `root`, and
so, by default, you can access it with `sudo`.
1. Log into Ubuntu as a user with `sudo` privileges.
Starting in version 0.5.3, if you (or your Docker installer) create a
Unix group called `docker` and add users to it, then the `docker` daemon
will make the ownership of the Unix socket read/writable by the `docker`
group when the daemon starts. The `docker` daemon must always run as the
`root` user, but if you run the `docker` client as a user in the
`docker` group then you don't need to add `sudo` to all the client
commands. From Docker 0.9.0 you can use the `-G` flag to specify an
alternative group.
2. Edit the `/etc/default/grub` file.
> **Warning**:
> The `docker` group (or the group specified with the `-G` flag) is
> `root`-equivalent; see [*Docker Daemon Attack Surface*](
> /articles/security/#docker-daemon-attack-surface) for details.
**Example:**
# Add the docker group if it doesn't already exist.
$ sudo groupadd docker
# Add the connected user "${USER}" to the docker group.
# Change the user name to match your preferred user.
# You may have to logout and log back in again for
# this to take effect.
$ sudo gpasswd -a ${USER} docker
# Restart the Docker daemon.
# If you are in Ubuntu 14.04, use docker.io instead of docker
$ sudo service docker restart
## Memory and Swap Accounting
If you want to enable memory and swap accounting, you must add the
following command-line parameters to your kernel:
cgroup_enable=memory swapaccount=1
On systems using GRUB (which is the default for Ubuntu), you can add
those parameters by editing `/etc/default/grub` and
extending `GRUB_CMDLINE_LINUX`. Look for the
following line:
GRUB_CMDLINE_LINUX=""
And replace it by the following one:
3. Set the `GRUB_CMDLINE_LINUX` value as follows:
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
Then run `sudo update-grub`, and reboot.
4. Save and close the file.
These parameters will help you get rid of the following warnings:
5. Update GRUB.
WARNING: Your kernel does not support cgroup swap limit.
WARNING: Your kernel does not support swap limit capabilities. Limitation discarded.
$ sudo update-grub
## Troubleshooting
6. Reboot your system.
On Linux Mint, the `cgroup-lite` and `apparmor` packages are not
installed by default. Before Docker will work correctly, you will need
to install this via:
$ sudo apt-get update && sudo apt-get install cgroup-lite apparmor
### Enable UFW forwarding
## Docker and UFW
If you use [UFW (Uncomplicated Firewall)](https://help.ubuntu.com/community/UFW)
on the same host as you run Docker, you'll need to do additional configuration.
Docker uses a bridge to manage container networking. By default, UFW drops all
forwarding traffic. As a result, for Docker to run when UFW is
enabled, you must set UFW's forwarding policy appropriately.
Docker uses a bridge to manage container networking. By default, UFW
drops all forwarding traffic. As a result you will need to enable UFW
forwarding:
Also, 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 also allow incoming
connections on the Docker port (default `2375`).
To configure UFW and allow incoming connections on the Docker port:
1. Log into Ubuntu as a user with `sudo` privileges.
2. Verify that UFW is installed and enabled.
$ sudo ufw status
3. Open the `/etc/default/ufw` file for editing.
$ sudo nano /etc/default/ufw
# Change:
# DEFAULT_FORWARD_POLICY="DROP"
# to
4. Set the `DEFAULT_FORWARD_POLICY` policy to:
DEFAULT_FORWARD_POLICY="ACCEPT"
Then reload UFW:
5. Save and close the file.
6. Reload UFW to use the new setting.
$ sudo ufw reload
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 2375):
7. Allow incoming connections on the Docker port.
$ sudo ufw allow 2375/tcp
## Docker and local DNS server warnings
### Configure a DNS server for use by Docker
Systems which are running Ubuntu or an Ubuntu derivative on the desktop
will use 127.0.0.1 as the default nameserver in /etc/resolv.conf.
NetworkManager sets up dnsmasq to use the real DNS servers of the
connection and sets up nameserver 127.0.0.1 in /etc/resolv.conf.
Systems that run Ubuntu or an Ubuntu derivative on the desktop typically use
`127.0.0.1` as the default `nameserver` in `/etc/resolv.conf` file. The
NetworkManager also sets up `dnsmasq` to use the real DNS servers of the
connection and sets up `nameserver 127.0.0.1` in /`etc/resolv.conf`.
When starting containers on these desktop machines, users will see a
warning:
When starting containers on desktop machines with these configurations, Docker
users see this warning:
WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can't use it. Using default external servers : [8.8.8.8 8.8.4.4]
WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers
can't use it. Using default external servers : [8.8.8.8 8.8.4.4]
This warning is shown because the containers can't use the local DNS
nameserver and Docker will default to using an external nameserver.
The warning occurs because Docker containers can't use the local DNS nameserver.
Instead, Docker defaults to using an external nameserver.
This can be worked around by specifying a DNS server to be used by the
Docker daemon for the containers:
To avoid this warning, you can specify a DNS server for use by Docker
containers. Or, you can disable `dnsmasq` in NetworkManager. Though, disabiling
`dnsmasq` might make DNS resolution slower on some networks.
To specify a DNS server for use by Docker:
1. Log into Ubuntu as a user with `sudo` privileges.
2. Open the `/etc/default/docker` file for editing.
$ sudo nano /etc/default/docker
---
# Add:
DOCKER_OPTS="--dns 8.8.8.8"
# 8.8.8.8 could be replaced with a local DNS server, such as 192.168.1.1
# multiple DNS servers can be specified: --dns 8.8.8.8 --dns 192.168.1.1
The Docker daemon has to be restarted:
3. Add a setting for Docker.
DOCKER_OPTS="--dns 8.8.8.8"
Replace `8.8.8.8` with a local DNS server such as `192.168.1.1`. You can also
specify multiple DNS servers. Separated them with spaces, for example:
--dns 8.8.8.8 --dns 192.168.1.1
>**Warning**: If you're doing this on a laptop which connects to various
>networks, make sure to choose a public DNS server.
4. Save and close the file.
5. Restart the Docker daemon.
$ sudo restart docker
> **Warning**:
> If you're doing this on a laptop which connects to various networks,
> make sure to choose a public DNS server.
An alternative solution involves disabling dnsmasq in NetworkManager by
following these steps:
&nbsp;
&nbsp;
**Or, as an alternative to the previous procedure,** disable `dnsmasq` in
NetworkManager (this might slow your network).
1. Open the `/etc/default/docker` file for editing.
$ sudo nano /etc/NetworkManager/NetworkManager.conf
----
# Change:
2. Comment out the `dns=dsnmasq` line:
dns=dnsmasq
# to
#dns=dnsmasq
NetworkManager and Docker need to be restarted afterwards:
3. Save and close the file.
$ sudo restart network-manager
$ sudo restart docker
4. Restart both the NetworkManager and Docker.
> **Warning**: This might make DNS resolution slower on some networks.
$ sudo restart network-manager $ sudo restart docker
## Mirrors
You should `ping get.docker.com` and compare the
latency to the following mirrors, and pick whichever one is best for
you.
## Upgrade Docker
### Yandex
To install the latest version of Docker, use the standard `-N` flag with `wget`:
[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.com/ubuntu` in the instructions above.
For example:
$ wget -N https://get.docker.com/ | sh
$ 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