前提条件
操作系统要求
要安装Docker Engine,您需要以下Ubuntu版本之一的64位版本:
Ubuntu Groovy 20.10
Ubuntu Focal 20.04(LTS)
Ubuntu Bionic 18.04(LTS)
Ubuntu Xenial 16.04(LTS)
Docker Engine在x86_64(或amd64)armhf,和arm64体系结构上受支持。
手动安装
卸载旧版本
Docker 的旧版本被称为 docker,docker.io 或 docker-engine 。如果已安装,请卸载它们:
$ sudo apt-get remove docker docker-engine docker.io containerd runc
使用官方安装脚本自动安装
安装命令如下:
# 更新apt-get库
sudo apt-get update
# 安装依赖
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
# 安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
也可以使用国内 daocloud 一键安装命令:
curl -sSL https://get.daocloud.io/docker | sh
检验
sudo docker run hello-world
# 输出
Hello from Docker!