- 卸载老版本
apt-get remove docker docker-engine docker.io containerd runc
-
使用存储库安装
- 安装需要的包
sudo apt update sudo apt upgrade
- 安装依赖
apt-get install ca-certificates curl gnupg lsb-release
- 添加密钥
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
- 添加docker软件源
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
- 安装需要的包
安装docker引擎
apt-get install docker-ce docker-ce-cli containerd.io
- 安装docker-compose
- 下载标准版docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.29.6/docker-compose-linux-x86_64 -o /usr/bin/docker-compose
- 授权
sudo chmod +x /usr/bin/docker-compose