简单方法:
docker.io Debian团队维护和打包
apt install docker.io
apt install docker-compose
但是版本会较低
复杂方法:
docker.ce Docker官方团队维护和打包
安装一些必要的系统工具
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
添加 Docker PGP key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
写入软件源信息
printf '%s\n' "deb https://download.docker.com/linux/debian bullseye stable" | sudo tee /etc/apt/sources.list.d/docker-ce.list
更新 APT
sudo apt update
如果安装了旧版本的 Docker ,先卸载它
sudo apt remove docker docker-engine docker.io
安装 Docker
sudo apt install docker-ce docker-ce-cli containerd.io
查看 Docker 状态
systemctl status docker
启动Docker
systemctl start docker
开机自动启动
systemctl enable docker
安装 docker-compose (github直接下载)
curl -L https://github.com/docker/compose/releases/download/v2.22.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
标签:compose,sudo,apt,io,Linux,Docker,安装,docker
From: https://blog.csdn.net/2302_81681718/article/details/139265321