1, 安装docker
sudo install docker.io
2, 安装以下包以使apt可以通过HTTPS使用存储库(repository):
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
3, 添加Docker官方的GPG密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4, 使用下面的命令来设置stable存储库:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5, 再更新一下apt包索引:
sudo apt-get update
6, 在生产系统上,可能会需要应该安装一个特定版本的Docker CE,列出可用的版本:
apt-cache madison docker-ce
验证docker
7, 查看docker服务是否启动:
systemctl status docker
8, 若未启动,则启动docker服务:
sudo systemctl start docker
9, 经典的hello world:
sudo docker run hello-world
done:安装成功