改用服务器系统源安装 Docker

This commit is contained in:
WuYongJie 2026-07-21 17:02:57 +08:00
parent 3e5f791051
commit 02c96bc497
2 changed files with 2 additions and 29 deletions

View File

@ -11,34 +11,7 @@ fi
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get update apt-get update
apt-get install -y --no-install-recommends ca-certificates curl openssl apt-get install -y --no-install-recommends ca-certificates openssl docker.io docker-compose-v2
install -m 0755 -d /etc/apt/keyrings
if [ ! -f /etc/apt/keyrings/docker.asc ]; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
fi
. /etc/os-release
ARCH="$(dpkg --print-architecture)"
CODENAME="${UBUNTU_CODENAME:-$VERSION_CODENAME}"
{
printf '%s\n' \
'Types: deb' \
'URIs: https://download.docker.com/linux/ubuntu' \
"Suites: $CODENAME" \
'Components: stable' \
"Architectures: $ARCH" \
'Signed-By: /etc/apt/keyrings/docker.asc'
} > /etc/apt/sources.list.d/docker.sources
apt-get update
if command -v docker >/dev/null 2>&1; then
apt-get install -y --no-install-recommends docker-buildx-plugin docker-compose-plugin
else
apt-get install -y --no-install-recommends docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
fi
systemctl enable --now docker systemctl enable --now docker
if ! swapon --show=NAME --noheadings | grep -q .; then if ! swapon --show=NAME --noheadings | grep -q .; then

View File

@ -55,7 +55,7 @@
初始化脚本会: 初始化脚本会:
- 安装并启动 Docker 与 Compose; - 使用服务器现有 Ubuntu 安全更新源安装并启动 Docker 与 Compose;
- 为 2GB 服务器增加 2GB swap(交换空间),仅用于运行时缓冲; - 为 2GB 服务器增加 2GB swap(交换空间),仅用于运行时缓冲;
- 创建 `/opt/caiwuxitong/runtime/.env`; - 创建 `/opt/caiwuxitong/runtime/.env`;
- 在服务器本地生成数据库密码和 Laravel `APP_KEY`,不会打印出来; - 在服务器本地生成数据库密码和 Laravel `APP_KEY`,不会打印出来;