Skip to content
Discussion options

You must be logged in to vote

你的构建失败是因为内存不足,近期版本(如 1.118.8 及以后)Docker 构建至少需要 16GB 内存,8GB 已无法满足需求,主要是 Next.js 构建和静态资源预加载导致内存占用大幅提升 参考

解决方法:

  1. 增加物理/虚拟机内存到 16GB 以上。

  2. 构建时设置环境变量提升 Node.js 最大堆内存,例如:

    NODE_OPTIONS="--max-old-space-size=8192" npm run build:docker
    

    或在 Dockerfile/build 命令里加上 NODE_OPTIONS,分配 8GB 或更高(如 16384)。

  3. 如果用 docker-compose,可以在服务配置里加上内存限制,例如:

    deploy:
      resources:
        limits:
          memory: 16G

    或运行容器时加 --memory=16g

目前没有发现近期有 pull request 或代码变更进一步提升了内存需求,主要还是 Next.js 及静态资源导致的构建瓶颈 参考

低于 16GB 内存基本无法顺利构建新版镜像,建议升级硬件或用云端构建后拉取镜像。

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by arvinxx
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #9045 on September 02, 2025 17:06.