阿里云部署Docker(1)阿里云Ubuntu环境搭建Docker服务
时间:2014-11-22 来源:服务器之家 投稿:root

阿里云部署Docker系列文章目录:
阿里云部署Docker(1)----阿里云Ubuntu环境搭建Docker服务
阿里云部署Docker(2)
阿里云部署Docker(3)----指令学习
阿里云部署Docker(4)----容器的使用
阿里云部署Docker(5)----管理和发布您的镜像
阿里云部署Docker(6)----解决删除镜像问题
阿里云部署Docker(7)----将容器连接起来
阿里云部署Docker(8)----安装和使用redmine
阿里云部署Docker(9)----Dockerfile脚本定制镜像

经过昨天和今天的不断奋战,在阿里云里面搭建Docker并不容易。所以我觉得有必要记录下来,以供后人学习。以及我自己的回顾。

首先,查看我们的系统版本:

cat /etc/issue

的到的输出是
Ubuntu 12.04.1 LTS n l

我们顺便看一下内核版本,因为Docker需要在3.8以上运行。
uname -r

可以得到你的内核版本,我因为要装docker,所以按照docker官网的步骤升级了内核,所以输出是:
3.8.0-44-generic

docker 的Ubuntu安装说明在:https://docs.docker.com/installation/ubuntulinux/

如何升级内核?

升级内核的步骤其实很简单,根据Docker官网提供的就好:

指令如下:

install the backported kernel

$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

install the backported kernel and xorg if using Unity/Xorg

$ sudo apt-get install --install-recommends linux-generic-lts-raring xserver-xorg-lts-raring libgl1-mesa-glx-lts-raring

reboot

$ sudo reboot

需要重启。

更新安装源

我在执行apt-get install docker.io的时候,总是提示找不到,所以说明我的安装源出了问题,所以,有必要说明如何搞定安装源,让我们的过程无错进行。

首先,备份源列表

cp /etc/apt/sources.list /etc/apt/sources.list_backup

然后,用vim 打开 源列表文件。
vim /etc/apt/sources.list

清空里面的已有列表,然后,我们选择阿里云列表,因为我们是阿里云服务器嘛。

阿里云源列表如下:

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

然后执行更新命令
apt-get update

这个时候会出现公钥问题

提示的错误类似如下:

W: There is no public key available for the following key IDs:
8B48AD6246925553

于是,我们又得解决这个问题。

执行如下命令:

apt-get install debian-keyring debian-archive-keyring && sudo apt-key update
apt-key adv --recv-key --keyserver keyserver.ubuntu.com 8B48AD6246925553

上述命令,的那个数字要换成你的,亲。

然后,再次执行apt-get update。发现可以了。没有问题。

于是,我们又回到“正事”,安装docker

apt-get install docker.io

这次顺利的完成了安装。

开启服务

root@iZ28ikebrg6Z:/etc/apt# service docker.io restart
stop: Unknown instance:
docker.io start/running, process 11430

不过接下来还会碰到问题。

docker run -i -t ubuntu /bin/bash
2014/10/15 11:31:30 Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

这个问题,下节继续。

转载请注明原文地址:http://www.server110.com/docker/201411/11135.html