1、Docker 的安装
安装 Docker :
sudo apt update
sudo apt install -y \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
启动Docker服务并设置开机自启:
sudo systemctl start docker
sudo systemctl enable docker
查看 Docker 安装版本
docker --version
2、Docker Compose 的安装
下载 Docker Compose 二进制文件
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
为 Docker Compose 二进制文件添加执行权限
sudo chmod +x /usr/local/bin/docker-compose
查看 Docker Compose 安装版本
docker-compose --version