Ubuntu安装docker

1.更新Ubuntu的源

修改 /etc/apt/sources.list中的默认文件

cn.archive.ubuntu.com换成mirrors.aliyun.com

2.更新

apt-get update

3.添加docker安装源

 bash -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" 

4.更新

apt-get update

 出错

W: GPG error: https://apt.dockerproject.org ubuntu-trusty InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F76221572C52609D

  解决方法

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys F76221572C52609D

  注: 

    F76221572C52609D,apt-get update 错误提示给出了

5.再次更新源

apt-get update

成功

6.删除旧的LXC

apt-get purge lxc-docker

7. 检查apt是否为docker官方源

apt-cache policy docker-engine

8.安装linux-image-extra内核包,这可以允许用户使用AUFS,可以提升容器的io性能

apt-get install linux-image-extra-$(uname -r)

9.安装

apt-get install docker-engine

  启动

service docker start

  测试

docker version

10.运行第一个容器

docker run hello-world

  

  

 

 

  

  

  

  

 

  

原文地址:https://www.cnblogs.com/baby123/p/7380053.html