发布于 2015-09-10 16:20:37 | 397 次阅读 | 评论: 0 | 来源: 网络整理

警告

由于下载太慢,需要修改hosts文件,或者修改docker.conf文件

vim /etc/hosts
54.234.135.251  get.docker.io
54.234.135.251  cdn-registry-1.docker.io
vim /etc/init/docker.conf
#在respawn后加
evn HTTP_PROXY="http://192.241.209.203:8384"

警告

These instructions have changed for 0.6. If you are upgrading from an earlier version, you will need to follow them again.

注解

Docker is still under heavy development! We don’t recommend using it in production yet, but we’re getting closer with each release. Please see our blog post, “Getting to Docker 1.0”

Docker is supported on the following versions of Ubuntu:

Please read Docker和防火墙, if you plan to use UFW (Uncomplicated Firewall)

Ubuntu Precise 12.04 (LTS) (64-bit)

This installation path should work at all times.

依赖关系

Linux kernel 3.8

Due to a bug in LXC, Docker works best on the 3.8 kernel. Precise comes with a 3.2 kernel, so we need to upgrade it. The kernel you’ll 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.

# install the backported kernel
sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

# reboot
sudo reboot

安装

警告

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 :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.

First add the Docker repository key to your local keychain.

sudo apt-key adv --keyserver keyserver.ubuntu.com --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 http://get.docker.io/ubuntu docker main
> /etc/apt/sources.list.d/docker.list"
sudo apt-get update
sudo apt-get install lxc-docker

注解

There is also a simple curl script available to help with this process.

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

Type exit to exit

Done!, now continue with the Hello World example.

Ubuntu Raring 13.04 and Saucy 13.10 (64 bit)

These instructions cover both Ubuntu Raring 13.04 and Saucy 13.10.

依赖关系

Optional AUFS filesystem support

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.

To make sure AUFS is installed, run the following commands:

sudo apt-get update
sudo apt-get install linux-image-extra-`uname -r`

安装

Docker is available as a Debian package, which makes installation easy.

警告

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.

sudo apt-key adv --keyserver keyserver.ubuntu.com --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
> /etc/apt/sources.list.d/docker.list"
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

Type exit to exit

Done!, now continue with the Hello World example.

赋予非root访问权限

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.

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.

警告

The docker group is root-equivalent.

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.
sudo service docker restart

更新

To install the latest version of docker, use the standard apt-get method:

# update your sources list
sudo apt-get update

# install the latest
sudo apt-get install lxc-docker

Troubleshooting

On Linux Mint, the cgroups-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 cgroups-lite

Docker和防火墙

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
----
# Change:
# DEFAULT_FORWARD_POLICY="DROP"
# to
DEFAULT_FORWARD_POLICY="ACCEPT"

Then reload UFW:

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

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 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:

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
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务