Debian11安装docker和docker-compose

it不难
2022-12-06 / 0 评论 / 19 阅读 / 正在检测是否收录...

前言

安装docker

# 依赖
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common

# 公钥
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg


# 添加源
## 官方源
echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# 安装
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

安装docker-compose

export LATEST_VERSION=$(wget -qO- -t1 -T2 "https://api.github.com/repos/docker/compose/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
curl -L https://github.com/docker/compose/releases/download/$LATEST_VERSION/docker-compose-linux-`uname -m` > ./docker-compose
chmod +x ./docker-compose
mv ./docker-compose /usr/local/bin/docker-compose
0

评论 (0)

取消