更新包管理工具
apt-get update
添加镜像源阿里云
apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository -y "deb [arch=$(dpkg --print-architecture)] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
安装 Docker CE 、 compose 插件 (由于是 compose 插件所以要用 docker compose 不能用 docker-compose)
apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
启动并且守护进程
sudo systemctl start docker
sudo systemctl enable docker
评论区