展开

docker 安装

最后发布时间 : 2024-02-27 14:42:29 浏览量 :

https://docs.docker.com/engine/install/ubuntu/

Uninstall old versions

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

Install using the apt repository

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] 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

install the Docker packages

docker --version
Docker version 20.10.18, build b40c2f6
apt-cache madison docker-ce | awk '{ print $3 }'
5:24.0.7-1~ubuntu.20.04~focal
5:24.0.6-1~ubuntu.20.04~focal
5:24.0.5-1~ubuntu.20.04~focal
5:24.0.4-1~ubuntu.20.04~focal
VERSION_STRING=5:20.10.18~3-0~ubuntu-focal
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin