Docker安装

Debian

前置条件

  • Debian Bookworm 12 (stable)
  • Debian Bullseye 11 (oldstable)

卸载旧版本

1
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

设置存储库

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

安装

1
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Ubuntu

前置条件

  • Ubuntu Noble 24.04 (LTS)
  • Ubuntu Mantic 23.10 (EOL: July 12, 2024)
  • Ubuntu Jammy 22.04 (LTS)
  • Ubuntu Focal 20.04 (LTS)

卸载旧版本

1
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

设置存储库

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

安装

1
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Windows

使用 Windows 安装 docker desktop

下载 docker desktop 即可

如果下载速度慢,可以使用我分享的网络链接:

https://www.123684.com/s/4MOKVv-P02pd?提取码:love

https://www.123865.com/s/4MOKVv-P02pd?提取码:love

直接在 WSL中安装

安装之前,下载你安装的wsl版本对应docker文件,比如我安装的系统是 debain 12

为什么下载 dcoker 安装文件安装,?因为 wsl 不是一个完整的系统,没有systemctl ,无法使用apt安装,所以需要手动下载文件安装

注意下载docker组件之间的版本适配,如何确定下载不同的版本呢,这里有个小技巧,

使用 Hugo 构建
主题 StackJimmy 设计