0%

尝鲜, ubuntu 安装Docker

尝鲜、尝鲜、尝鲜!!! 开始安装Docker吧,多余的话不说了。

安装要求

  • ubuntu 64 bit系统
  • 系统内核3.10及以上 命令uname -r

安装步骤

系统包更新

1
2
sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates

增加GPG key

1
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

增加下载源

vim /etc/apt/sources.list.d/docker.list 添加以下内容:

  • On Ubuntu Precise 12.04 (LTS)
1
deb https://apt.dockerproject.org/repo ubuntu-precise main
  • On Ubuntu Trusty 14.04 (LTS)
1
deb https://apt.dockerproject.org/repo ubuntu-trusty main
  • On Ubuntu Wily 15.10
1
deb https://apt.dockerproject.org/repo ubuntu-wily main
  • On Ubuntu Xenial 16.04 (LTS)
1
deb https://apt.dockerproject.org/repo ubuntu-xenial main

系统包更新

1
sudo apt-get update

删除旧Docker
检查系统是否已经安装docker并移除老版本

1
sudo apt-get purge lxc-docker

验证安装Docker

1
apt-cache policy docker-engine

安装依赖包

1
2
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

安装Docker

1
sudo apt-get install docker-engine

启动Docker

1
sudo service docker start

验证Docker安装
下载并启动hello-world的docker镜像,终端打印hello world

1
sudo docker run hello-world