安装Docker
1、卸载可能存在的旧版本
sudo apt remove docker docker-engine docker-ce docker.io
2、安装依赖包
sudo apt update && apt install -y apt-transport-https ca-certificates curl software-properties-common
3、添加Docker密钥(使用阿里云源)
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
4、添加Docker源(阿里云),若下载amd版本改为[arch=amd64]
sudo add-apt-repository "deb [arch=arm64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
5、安装Docker
sudo apt update && apt install -y docker-ce
6、查看Docker状态
sudo systemctl status docker && docker -v && docker ps
安装Docker Compose
1、下载最新的Docker Compose二进制文件
sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2、授予执行权限
sudo chmod +x /usr/local/bin/docker-compose
3、验证安装
docker-compose --version