前言
centos7上的软件版本都比较旧了,尝试一下debian。
Debian11
安装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
ubuntu
版本信息:Ubuntu 22.04 LTS
# 源
apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 安装
apt update && apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-compose
# 验证
docker --version
docker-compose --version
设置国内源
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
]
}
评论 (0)