You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins Ubuntu环境下Docker Build执行Yarn命令失败求助

Docker构建Yarn命令失败:Node线程创建断言错误问题分析

问题详情

Dockerfile(片段)

# Stage 1: Install Dependencies
FROM node:18.19.1 AS dependencies

WORKDIR /app

# Install dependencies
RUN yarn config set strict-ssl false && yarn global add @angular/cli@19.1.0

构建错误日志

Digest: sha256:b39895225fb1984139d5af76400aff8fac3dd5bc00dd41a3ce22fc8a6cf538d5
Status: Downloaded newer image for node:18.19.1
 ---> 9489b43a1afc
Step 2/27 : WORKDIR /app
 ---> Running in 7484fe9b74ce
Removing intermediate container 7484fe9b74ce
 ---> 6a42dd0aa757
Step 3/27 : RUN yarn config set strict-ssl false && yarn global add @angular/cli@16.2.8
 ---> Running in 1d3439efdc5f
node[8]: ../src/node_platform.cc:68:std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start(): Assertion `(0) == (uv_thread_create(t.get(), start_thread, this))' failed.
 1: 0xb95be0 node::Abort() [node]
 2: 0xb95c5e  [node]
 3: 0xc045ae  [node]
 4: 0xc04691 node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
 5: 0xb50e63 node::InitializeOncePerProcess(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::ProcessFlags::Flags) [node]
 6: 0xb514bb node::Start(int, char**) [node]
 7: 0x7f13fc22c24a  [/lib/x86_64-linux-gnu/libc.so.6]
 8: 0x7f13fc22c305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
 9: 0xacfdce _start [node]
Aborted (core dumped)
The command '/bin/sh -c yarn config set strict-ssl false && yarn global add @angular/cli@16.2.8' returned a non-zero code: 134
[Pipeline] echo
Failed to Build Docker Image 

环境信息

  • 尝试过的Node基础镜像:node:18.19.1、^20.11.1、>=22.0.0版本
  • Yarn版本:v1.22.19
  • Jenkins服务器Docker版本:Docker version 19.03.12
  • Jenkins服务器ulimit -a输出:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 192387
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 393216
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 131072
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

问题原因

  • Docker版本与Node镜像兼容性问题:Docker 19.03.12是2020年的旧版本,而node:18.19.1及更高版本的镜像基于较新的Linux发行版(如Debian 12),这些镜像依赖的内核特性、系统库与旧版Docker的容器运行环境不匹配,导致Node.js无法正常创建工作线程,触发断言失败。
  • 容器内线程资源调度限制:尽管宿主机ulimit显示资源充足,但旧版Docker对容器的线程管理存在缺陷,无法满足Node.js启动工作线程的资源需求,进而引发线程创建错误。
  • Yarn与Node版本不匹配:Yarn v1.22.19发布于2022年,和2024年发布的node:18.19.1版本跨度较大,两者之间存在未兼容的底层逻辑,执行Yarn命令时触发了线程创建的异常。

内容的提问来源于stack exchange,提问作者Thabo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 06:44:51