官网:Empowering App Development for Developers | Docker
从 2017 年 3 月开始 docker 在原来的基础上分为两个分支版本: Docker CE 和 Docker EE。
Docker CE 即社区免费版,Docker EE 即企业版,强调安全,但需付费使用。
本文安装的 Docker CE 版本:20.10.11
环境准备
- Linux 发行版:Ubuntu Focal 20.04 (LTS)
- Linux 内核:Linux 5.4.0-90-generic
可用虚拟机安装 Ubuntu 。
参考:vagrant 搭建 CentOS 7 虚拟机开发环境-CSDN博客
把文中的 CentOS 镜像换成 Ubuntu 即可。
安装 Docker
参考:Install Docker Engine on Ubuntu | Docker Documentation
卸载旧版本 docker
$ sudo apt-get remove docker docker-engine docker.io containerd runc
使用 repository 安装
在新主机上首次安装 Docker Engine-Community 之前,需要设置 Docker 仓库。之后,可以从仓库安装和更新 Docker 。
设置仓库
# 更新 apt 包索引
$ sudo apt-get update
# 安装依赖包,让 apt 可以通过 HTTPS 获取仓库
$ sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# 添加 Docker 官方 GPG 密钥
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg