跳到主要内容

安装Docker

· 阅读需 1 分钟

步骤一:更新系统

sudo apt update
sudo apt upgrade

步骤二:安装Docker依赖项

sudo apt install apt-transport-https ca-certificates curl software-properties-common

步骤三:添加Docker官方GPG密钥

curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg | sudo apt-key add -

步骤四:添加Docker官方源

echo 'deb https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/ buster stable' | sudo tee /etc/apt/sources.list.d/docker.list

步骤五:安装Docker引擎

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

步骤六:验证Docker安装

docker --version
docker-compose -v
apt-get install docker-compose -y
v2.19.1
sudo curl -L "https://github.com/docker/compose/releases/download/v2.19.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
https://github.com/docker/compose/releases/download/v2.19.1/docker-compose-linux-x86_64