原创

Ubuntu18.04安装docker-ce

一、修改源为清华大学源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

二、如果之前装过 Docker 的,先卸载

sudo apt-get remove docker docker-engine docker.io

三、更新一下镜像源

sudo apt-get update

四、安装对应的依赖

sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common

五、添加对 DockerGPG 公钥信任

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

六、添加软件仓库

这里我 Ubuntu 是64位的,如下:

sudo add-apt-repository "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

七、更新源

sudo apt-get update

八、安装 Docker-ce

sudo apt-get install docker-ce

九、查看是否安装成功

docker -v
正文到此结束
本文目录