操作环境:Ubuntu 24.04.4 LTS
# 更换apt源
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
sudo tee /etc/apt/sources.list.d/ubuntu.sources >/dev/null <<'EOF'
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: https://mirrors.tuna.tsinghua.edu.cn/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
sudo apt update
# 安装docker
sudo apt install -y docker.io docker-compose-v2
systemctl enable docker
# 插入配置文件
cat > /etc/docker/daemon.json << EOF
{
"data-root": "/data/docker",
"bip": "10.0.1.1/24",
"default-address-pools" : [
{
"base" : "10.0.0.0/16",
"size" : 24
}
],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "5",
"compress": "true"
}
}
EOF
mkdir -p /data/docker
systemctl restart docker
赏
使用支付宝打赏
使用微信打赏
若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏