# Fastgpt Docker Deploy

FastGPT Docker Compose self-hosting deployment workflow.

- Repository: https://github.com/labring/FastGPT (29968 stars)
- Category: AI and agents
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add labring/FastGPT --skill fastgpt-docker-deploy -g -a claude-code -y`
Codex: `npx skills add labring/FastGPT --skill fastgpt-docker-deploy -g -a codex -y`
Cursor: `npx skills add labring/FastGPT --skill fastgpt-docker-deploy -g -a cursor -y`
Gemini CLI: `npx skills add labring/FastGPT --skill fastgpt-docker-deploy -g -a gemini-cli -y`

## Description

FastGPT Docker Compose self-hosting deployment workflow. Use when a user asks an AI agent to deploy FastGPT with Docker by referencing /deploy/SKILL.md, including creating an empty fastgpt directory, running the install script in non-interactive mode, starting Docker Compose, monitoring service health, troubleshooting compose issues, and returning the access URL plus root credentials and next steps.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# FastGPT Docker 部署

## 目标

在一台已有终端访问权限的 Linux、macOS 或 Windows WSL 服务器上，通过 FastGPT 官方交互式脚本生成 Docker Compose 配置，启动服务，确认 FastGPT 可访问，最后把访问地址、账号、密码和下一步动作交给用户。

## 工作边界

- 优先使用官方脚本：`https://doc.fastgpt.cn/deploy/install.sh`。
- 默认使用脚本非交互模式：国内镜像源、自动随机密钥、检测到的第一个主 IP、`PostgreSQL + pgvector` 向量库。
- 不要覆盖用户已有的 `docker-compose.yml` 或数据卷，除非用户明确同意。
- 不要在公开输出里泄露除 `root` 初始登录密码外的服务 Token、数据库密码或应用密钥。
- 如果宿主机已有反向代理、域名或云厂商防火墙，先完成本机部署验证，再提醒用户开放或映射脚本最终输出的宿主机端口。默认 FastGPT/Sandbox Proxy 为 `3000`/`3006`，MCP 为 `3003`；仅旧版外部 S3 下载链路还需要开放 `9000`。

## 部署流程

1. 检查运行环境：

   ```bash
   docker -v
   docker compose version
   curl --version
   ```

   如果 Docker 或 Compose 不存在，先向用户说明缺失项。只有在用户授权安装系统软件时，才安装 Docker。

2. 创建空的 `fastgpt` 部署目录：

   ```bash
   mkdir -p ~/fastgpt
   cd ~/fastgpt
   if [ -n "$(ls -A .)" ]; then
     echo "当前目录非空，请先确认是否继续或改用新的空目录。"
     exit 1
   fi
   ```

   如果目录非空，先读取文件和 `docker compose ps` 判断是否已有部署，不要直接覆盖。让用户确认继续使用当前目录、备份旧文件，或改用新的空目录。

3. 下载并运行官方脚本：

   ```bash
   curl -fsSL https://doc.fastgpt.cn/deploy/install.sh -o install.sh
   FASTGPT_NON_INTERACTIVE=true bash install.sh
   ```

   非交互模式会默认选择最新稳定版本、国内镜像源、`PostgreSQL + pgvector`、自动随机密钥，并把 MCP 地址设置为检测到的第一个主 IP。还必须提供用户访问地址 `FASTGPT_FE_DOMAIN`；启用 Agent/Skill Sandbox 时，再提供 `FASTGPT_SANDBOX_PROXY_URL`，v4.16 还需要 `FASTGPT_SANDBOX_PREVIEW_PROXY_URL`。当前版本的默认 `short-proxy` 下载模式不需要配置外部 S3 地址。

   如果用户明确给了 MCP 公网域名或固定 IP，用环境变量覆盖 endpoint：

   ```bash
   FASTGPT_NON_INTERACTIVE=true \
   FASTGPT_MCP_ENDPOINT=https://mcp.example.com:3003 \
   bash install.sh
   ```

   `FASTGPT_S3_ENDPOINT` 仅用于仍包含 `STORAGE_EXTERNAL_ENDPOINT` 的 v4.14 或本地旧版 Compose。

The rest: https://github.com/labring/FastGPT/blob/HEAD/document/public/deploy/SKILL.md
