Docker安装

Docker安装

Administrator 405 2022-07-18

一、官方脚本一键安装

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

Or

curl -sSL https://get.daocloud.io/docker | sh

二、第三方脚本定制安装安装

bash <(curl -sSL https://cdn.jsdelivr.net/gh/SuperManito/LinuxMirrors@main/DockerInstallation.sh)

三、手动从源安装

1. 卸载旧版本

apt remove docker docker-engine docker.io containerd runc

2. 安装软件包以允许 apt 通过 HTTPS 使用存储库

apt update 
apt install apt-transport-https ca-certificates curl software-properties-common gnupg2

3. 添加 Docker 的官方 GPG 密钥:

curl -fsSL https://download.docker.com/linux/debian/gpg | 
sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. 添加源

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

5. 安装 docker 引擎

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

Docker-conpose安装

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version