Debian12 Docker - 安装 - 优化
Debian12 Docker - 安装 - 优化

1 - 安装 Debian 12

通过 https://www.osboxes.org/debian/ 下载 适配 Vmware 的OS镜像

查看 OS Info

uname -a
lsb_release -a
cat /etc/os-release

修改 APT

vi /etc/apt/sources.list

修改内容

# Tsinghua University
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

更新源

sudo apt update

2 - 安装Docker & Docker Compose CE版本

export https_proxy="http://127.0.0.1:8118"
export http_proxy="http://127.0.0.1:8118"

env
# 此步骤需要梯子
curl -sS https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list

ls /etc/apt/sources.list.d/
cat /etc/apt/sources.list.d/docker.list 
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
docker version
docker compose version

3 - 设置 Socks5 代理

3.1 创建如下文件

vi /etc/systemd/system/docker.service.d/proxy.conf

3.2 文件中填写如下内容

[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:1080"
Environment="HTTPS_PROXY=socks5://127.0.0.1:1080"

4 - 重启Docker

systemctl daemon-reload
systemctl restart docker

[腾讯云 安装 Docker]https://cloud.tencent.com/document/product/213/46000#agw1lQAjlPGNKN9VsnRD8)


最后修改于 2024-07-24

此篇文章的评论功能已经停用。