1. 把Ubuntu的源更换为清华大学的源
将/etc/apt/sources.list源文件改为以下内容:
deb [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial main restricted universe multiverse
# deb-src [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial main restricted universe multiverse
deb [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-updates main restricted universe multiverse
# deb-src [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-updates main restricted universe multiverse
deb [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-backports main restricted universe multiverse
# deb-src [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-backports main restricted universe multiverse
deb [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-security main restricted universe multiverse
# deb-src [https://mirrors.tuna.tsinghua.edu.cn/ubuntu/](https://mirrors.tuna.tsinghua.edu.cn/ubuntu/) xenial-security main restricted universe multiverse
2. 更新安装源
sudo apt-get update
3. 安装依赖
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properies-commom
4. 信任docker的GPG公钥
curl -fsSL [https://download.docker.com/linux/ubuntu/gpg](https://download.docker.com/linux/ubuntu/gpg) | sudo apt-key add -
5. 添加软件库
sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
6. 安装docker
sudo apt-get update
sudo apt-get install docker-ce