脚本安装:
wget -O 1keji.sh "https://www.1keji.net" && chmod +x 1keji.sh && ./1keji.sh
交互界面选16。
手动安装:
先写数据库文件与权限:
mkdir -p /root/.docker/modern-images
touch /root/.docker/modern-images/images.db
chown 1001:65533 /root/.docker/modern-images/images.db
chmod 664 /root/.docker/modern-images/images.db
touch /root/.docker/modern-images/config.json
chown 1001:65533 /root/.docker/modern-images/config.json
chmod 664 /root/.docker/modern-images/config.json
初始安装更改config.json文件内容:
{
"auth": {
"isConfigured": false,
"username": "",
"hashedPassword": "",
"salt": ""
},
"api": {
"enabled": true,
"tokens": [],
"defaultFormat": "original"
},
"storage": {
"type": "local",
"r2": {
"enabled": false,
"accessKeyId": "",
"secretAccessKey": "",
"endpoint": "",
"bucket": "",
"region": "auto",
"customDomain": ""
}
}
}
运行docker
docker run -d \
--name modern-images \
-p 3000:3000 \
-v /root/.docker/modern-images/uploads:/app/uploads \
-v /root/.docker/modern-images/images.db:/app/images.db \
-v /root/.docker/modern-images/sessions:/app/sessions \
-v /root/.docker/modern-images/config.json:/app/config.json \
-e NODE_ENV=production \
-e PORT=3000 \
--restart unless-stopped \
--health-cmd='node -e "const http = require(\"http\"); const options = { hostname: \"localhost\", port: 3000, path: \"/\", timeout: 2000 }; http.get(options, (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on(\"error\", () => process.exit(1));"' \
--health-interval=30s \
--health-timeout=10s \
--health-retries=3 \
--health-start-period=40s \
1keji/modern-images:latest
改变宿主挂载目录的属主
执行以下命令即可:
chown -R 1001:65533 /root/.docker/modern-images
半自动安装:
#!/bin/bash
# 创建持久化目录
mkdir -p /root/.docker/modern-images
# 创建数据库文件(如不存在)
[ ! -f "/root/.docker/modern-images/images.db" ] && touch "/root/.docker/modern-images/images.db"
chown 1001:65533 "/root/.docker/modern-images/images.db"
chmod 664 "/root/.docker/modern-images/images.db"
# 创建 config.json 文件(如不存在)
[ ! -f "/root/.docker/modern-images/config.json" ] && cat > "/root/.docker/modern-images/config.json" << 'EOF'
{
"auth": {
"isConfigured": false,
"username": "",
"hashedPassword": "",
"salt": ""
},
"api": {
"enabled": true,
"tokens": [],
"defaultFormat": "original"
},
"storage": {
"type": "local",
"r2": {
"enabled": false,
"accessKeyId": "",
"secretAccessKey": "",
"endpoint": "",
"bucket": "",
"region": "auto",
"customDomain": ""
}
}
}
EOF
chown 1001:65533 "/root/.docker/modern-images/config.json"
chmod 664 "/root/.docker/modern-images/config.json"
运行docker
docker run -d \
--name modern-images \
-p 3015:3000 \
-v /root/.docker/modern-images/uploads:/app/uploads \
-v /root/.docker/modern-images/images.db:/app/images.db \
-v /root/.docker/modern-images/sessions:/app/sessions \
-v /root/.docker/modern-images/config.json:/app/config.json \
-e NODE_ENV=production \
-e PORT=3000 \
--restart unless-stopped \
--health-cmd='node -e "const http = require(\"http\"); const options = { hostname: \"localhost\", port: 3000, path: \"/\", timeout: 2000 }; http.get(options, (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on(\"error\", () => process.exit(1));"' \
--health-interval=30s \
--health-timeout=10s \
--health-retries=3 \
--health-start-period=40s \
1keji/modern-images:latest
改变宿主挂载目录的属主
执行以下命令即可:
chown -R 1001:65533 /root/.docker/modern-images
持久化目录和端口各位可以自行修改设置