安装Docker
官方安装文档
https://docs.docker.com/engine/install/debian/#install-using-the-repository
清理
sudo apt-get remove docker docker-engine docker.io containerd runc
安装依赖
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
添加 Docker 的官方 GPG 密钥:
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
安装
udo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
重启 docker 并设置开机自启
sudo systemctl enable docker
sudo systemctl daemon-reload
sudo systemctl restart docker
允许运行普通账号直接执行 docker 命令
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
官方文档
https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user
安装 Docker Compose
sudo curl -L https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-`uname -m` > ./docker-compose
sudo chmod +x ./docker-compose
sudo mv ./docker-compose /usr/local/bin/docker-compose