1.先更新系统并安装相关依赖包
$ sudo apt update$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
2.新建并编辑etc/apt/sources.list.d/docker.list文件
$ sudo vi /etc/apt/sources.list.d/docker.list文件内容如下:deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
3.添加秘钥
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4.更新docker源apt仓库信息
$ sudo apt update
5.安装docker-ce
$ sudo apt install docker-ce
6.验证
$ docker --version