|
@@ -33,13 +33,13 @@ installs all its prerequisites from Ubuntu's repository.
|
|
|
|
|
|
To install the latest Ubuntu package (may not be the latest Docker release):
|
|
|
|
|
|
- sudo apt-get update
|
|
|
- sudo apt-get install docker.io
|
|
|
- sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
|
|
+ $ sudo apt-get update
|
|
|
+ $ sudo apt-get install docker.io
|
|
|
+ $ sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
|
|
|
|
|
|
To verify that everything has worked as expected:
|
|
|
|
|
|
- sudo docker run -i -t ubuntu /bin/bash
|
|
|
+ $ sudo docker run -i -t ubuntu /bin/bash
|
|
|
|
|
|
Which should download the `ubuntu` image, and then start `bash` in a container.
|
|
|
|
|
@@ -61,11 +61,11 @@ VirtualBox guest additions. If you didn't install the headers for your
|
|
|
kernel. But it is safer to include them if you're not sure.
|
|
|
|
|
|
# install the backported kernel
|
|
|
- sudo apt-get update
|
|
|
- sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
|
|
|
+ $ sudo apt-get update
|
|
|
+ $ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
|
|
|
|
|
|
# reboot
|
|
|
- sudo reboot
|
|
|
+ $ sudo reboot
|
|
|
|
|
|
### Installation
|
|
|
|
|
@@ -90,7 +90,7 @@ should exist. If it doesn't, you need to install the package
|
|
|
|
|
|
Then, add the Docker repository key to your local keychain.
|
|
|
|
|
|
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
|
|
|
+ $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
|
|
|
|
|
|
Add the Docker repository to your apt sources list, update and install
|
|
|
the `lxc-docker` package.
|
|
@@ -98,21 +98,21 @@ 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.io/ubuntu docker main\
|
|
|
+ $ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main\
|
|
|
> /etc/apt/sources.list.d/docker.list"
|
|
|
- sudo apt-get update
|
|
|
- sudo apt-get install lxc-docker
|
|
|
+ $ 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 -s https://get.docker.io/ubuntu/ | sudo sh
|
|
|
+> $ curl -s https://get.docker.io/ubuntu/ | sudo sh
|
|
|
|
|
|
Now verify that the installation has worked by downloading the
|
|
|
`ubuntu` image and launching a container.
|
|
|
|
|
|
- sudo docker run -i -t ubuntu /bin/bash
|
|
|
+ $ sudo docker run -i -t ubuntu /bin/bash
|
|
|
|
|
|
Type `exit` to exit
|
|
|
|
|
@@ -134,8 +134,8 @@ available as a driver and we recommend using it if you can.
|
|
|
|
|
|
To make sure AUFS is installed, run the following commands:
|
|
|
|
|
|
- sudo apt-get update
|
|
|
- sudo apt-get install linux-image-extra-`uname -r`
|
|
|
+ $ sudo apt-get update
|
|
|
+ $ sudo apt-get install linux-image-extra-`uname -r`
|
|
|
|
|
|
### Installation
|
|
|
|
|
@@ -147,20 +147,20 @@ Docker is available as a Debian package, which makes installation easy.
|
|
|
|
|
|
First add the Docker repository key to your local keychain.
|
|
|
|
|
|
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
|
|
|
+ $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
|
|
|
|
|
|
Add the Docker repository to your apt sources list, update and install
|
|
|
the `lxc-docker` package.
|
|
|
|
|
|
- sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
|
|
|
+ $ sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
|
|
|
> /etc/apt/sources.list.d/docker.list"
|
|
|
- sudo apt-get update
|
|
|
- sudo apt-get install lxc-docker
|
|
|
+ $ sudo apt-get update
|
|
|
+ $ sudo apt-get install lxc-docker
|
|
|
|
|
|
Now verify that the installation has worked by downloading the
|
|
|
`ubuntu` image and launching a container.
|
|
|
|
|
|
- sudo docker run -i -t ubuntu /bin/bash
|
|
|
+ $ sudo docker run -i -t ubuntu /bin/bash
|
|
|
|
|
|
Type `exit` to exit
|
|
|
|
|
@@ -194,16 +194,16 @@ than `docker` should own the Unix socket with the
|
|
|
**Example:**
|
|
|
|
|
|
# Add the docker group if it doesn't already exist.
|
|
|
- sudo groupadd docker
|
|
|
+ $ 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
|
|
|
+ $ sudo gpasswd -a ${USER} docker
|
|
|
|
|
|
# Restart the Docker daemon.
|
|
|
- sudo service docker restart
|
|
|
+ $ sudo service docker restart
|
|
|
|
|
|
### Upgrade
|
|
|
|
|
@@ -211,28 +211,28 @@ To install the latest version of docker, use the standard
|
|
|
`apt-get` method:
|
|
|
|
|
|
# update your sources list
|
|
|
- sudo apt-get update
|
|
|
+ $ sudo apt-get update
|
|
|
|
|
|
# install the latest
|
|
|
- sudo apt-get install lxc-docker
|
|
|
+ $ sudo apt-get install lxc-docker
|
|
|
|
|
|
## 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
|
|
|
+ $ 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=""
|
|
|
+ $ GRUB_CMDLINE_LINUX=""
|
|
|
|
|
|
And replace it by the following one:
|
|
|
|
|
|
- GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
|
|
|
+ $ GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
|
|
|
|
|
|
Then run `sudo update-grub`, and reboot.
|
|
|
|
|
@@ -247,7 +247,7 @@ On Linux Mint, the `cgroup-lite` package is 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
|
|
|
+ $ sudo apt-get update && sudo apt-get install cgroup-lite
|
|
|
|
|
|
## Docker and UFW
|
|
|
|
|
@@ -255,22 +255,22 @@ 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:
|
|
|
|
|
|
- sudo nano /etc/default/ufw
|
|
|
- ----
|
|
|
+ $ sudo nano /etc/default/ufw
|
|
|
+
|
|
|
# Change:
|
|
|
# DEFAULT_FORWARD_POLICY="DROP"
|
|
|
# to
|
|
|
- DEFAULT_FORWARD_POLICY="ACCEPT"
|
|
|
+ $ DEFAULT_FORWARD_POLICY="ACCEPT"
|
|
|
|
|
|
Then reload UFW:
|
|
|
|
|
|
- sudo ufw reload
|
|
|
+ $ 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 4243):
|
|
|
|
|
|
- sudo ufw allow 4243/tcp
|
|
|
+ $ sudo ufw allow 4243/tcp
|
|
|
|
|
|
## Docker and local DNS server warnings
|
|
|
|
|
@@ -290,16 +290,16 @@ nameserver and Docker will default 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:
|
|
|
|
|
|
- sudo nano /etc/default/docker
|
|
|
+ $ sudo nano /etc/default/docker
|
|
|
---
|
|
|
# Add:
|
|
|
- DOCKER_OPTS="--dns 8.8.8.8"
|
|
|
+ $ 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:
|
|
|
|
|
|
- sudo restart docker
|
|
|
+ $ sudo restart docker
|
|
|
|
|
|
> **Warning**:
|
|
|
> If you're doing this on a laptop which connects to various networks,
|
|
@@ -308,7 +308,7 @@ The Docker daemon has to be restarted:
|
|
|
An alternative solution involves disabling dnsmasq in NetworkManager by
|
|
|
following these steps:
|
|
|
|
|
|
- sudo nano /etc/NetworkManager/NetworkManager.conf
|
|
|
+ $ sudo nano /etc/NetworkManager/NetworkManager.conf
|
|
|
----
|
|
|
# Change:
|
|
|
dns=dnsmasq
|
|
@@ -317,8 +317,8 @@ following these steps:
|
|
|
|
|
|
NetworkManager and Docker need to be restarted afterwards:
|
|
|
|
|
|
- sudo restart network-manager
|
|
|
- sudo restart docker
|
|
|
+ $ sudo restart network-manager
|
|
|
+ $ sudo restart docker
|
|
|
|
|
|
> **Warning**: This might make DNS resolution slower on some networks.
|
|
|
|
|
@@ -336,7 +336,7 @@ Substitute `http://mirror.yandex.ru/mirrors/docker/` for
|
|
|
`http://get.docker.io/ubuntu` in the instructions above.
|
|
|
For example:
|
|
|
|
|
|
- sudo sh -c "echo deb http://mirror.yandex.ru/mirrors/docker/ docker main\
|
|
|
+ $ 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
|
|
|
+ $ sudo apt-get update
|
|
|
+ $ sudo apt-get install lxc-docker
|