Debian上安装Docker的步骤
Here’s the complete set of steps to install Docker on Debian:
Step 1: Download the GPG Key
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 2: Add the Docker APT Repository
echo "deb [arch=amd64 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
Step 3: Update the APT Package Index
sudo apt-get update
Step 4: Install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 5: Verify the Installation
sudo docker run hello-world
Step 6: Manually Download DEB Packages (Optional)
If you encounter issues with the APT repository method, you can manually download and install the DEB packages.
Docker CE:
curl -fsSL https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64/docker-ce_20.10.24~3-0~debian-bullseye_amd64.deb -o docker-ce.deb
Docker CE CLI:
curl -fsSL https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64/docker-ce-cli_20.10.24~3-0~debian-bullseye_amd64.deb -o docker-ce-cli.deb
Containerd:
curl -fsSL https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64/containerd.io_1.6.14-1_amd64.deb -o containerd.io.deb
Docker Compose Plugin:
curl -fsSL https://download.docker.com/linux/debian/dists/bullseye/pool/stable/amd64/docker-compose-plugin_2.6.0~debian-bullseye_amd64.deb -o docker-compose-plugin.deb
Step 7: Install the DEB Packages
sudo dpkg -i docker-ce.deb docker-ce-cli.deb containerd.io.deb docker-compose-plugin.deb
Step 8: Fix Any Dependency Issues
sudo apt-get install -f
Step 9: Verify the Installation
sudo docker run hello-world
This comprehensive guide should help you install Docker on Debian successfully.