Ubuntu下Docker详细安装教程

为什么要用docker,只有用过的人才知道有多爽,研究了几天,在centos下安装总会出现各种问题,新手建议使用Ubuntu,用下面的步骤安装成功,亲历为证。

以下内容根据 官方文档 修改而来。

如果你过去安装过 docker,先删掉:

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

首先安装依赖:

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

信任 Docker 的 GPG 公钥:

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

对于 amd64 架构的计算机,添加软件仓库:

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

如果你是树莓派或其它ARM架构计算机,请运行:

echo "deb [arch=armhf] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \      $(lsb_release -cs) stable" | \     sudo tee /etc/apt/sources.list.d/docker.list

最后安装:

sudo apt-get update

sudo apt-get install docker-ce

配置加速:

前往阿里云https://cn.aliyun.com/用你的支付宝账号登录,然后选择容器镜像服务-->镜像加速器会看到:

按步骤操作即可。

好了,现在你可以愉快的使用docker了。

猜你喜欢

转载自blog.csdn.net/weixin_42363997/article/details/83578995