colima icon indicating copy to clipboard operation
colima copied to clipboard

Segmentation Fault During vite build in Docker on Colima (Works Outside Docker)

Open amit11893 opened this issue 7 months ago • 2 comments

Description

Running vite build inside a Docker container managed by Colima on an Intel Mac results in a segmentation fault. The same build process completes successfully:

  1. Outside Docker on the host (Node 20, npm 10)

  2. Inside Docker when using Docker Desktop

This suggests a runtime or filesystem-level issue related to Colima’s environment.

Could you please advise if this is a known limitation or if there are any workarounds? I'm happy to provide a full reproducible container configuration and additional trace logs if needed.

Version

colima version 0.8.1 git commit: 96598cc5b64e5e9e1e64891642b91edc8ac49d16 limactl version 1.0.7 qemu-img version 2.12.0(gradle_1.3.0-beta4-81840-g64886e740b)

Operating System

  • [x] macOS Intel <= 13 (Ventura)
  • [ ] macOS Intel >= 14 (Sonoma)
  • [ ] Apple Silicon <= 13 (Ventura)
  • [ ] Apple Silicon >= 14 (Sonoma)
  • [ ] Linux

Output of colima status

INFO[0000] colima is running using macOS Virtualization.Framework INFO[0000] arch: x86_64
INFO[0000] runtime: docker
INFO[0000] mountType: sshfs
INFO[0000] socket: unix:///Users/*

Reproduction Steps

  1. Clone the repository: https://github.com/tiangolo/full-stack-fastapi-postgresql.git
  2. Ensure you are on an Intel Mac, using Colima as your Docker backend.
  3. inside the repository, run docker-compose up frontend
  4. Observe that the build fails with a segmentation fault during the npm run build step, specifically when Vite transforms index.html.

Expected behaviour

Expected it to be able to build smoothly without segfault error.

Additional context

Additional Observations:

Running npm ci on the host and copying node_modules into the container still results in a segmentation fault.

Switching to Docker Desktop eliminates the issue entirely.

The segmentation fault consistently occurs during Vite's HTML transformation or dependency graph building.

No explicit use of esbuild in the project.

strace Log:

Attaching the final part of strace showing the crash:

pgsql Copy Edit mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x55691c12e000 mprotect(0x55691c120000, 4096, PROT_READ) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x18} --- +++ killed by SIGSEGV (core dumped) +++

amit11893 avatar Apr 15 '25 03:04 amit11893

Have you tried using VZ rather than Qemu when starting Colima?

MatthewRyanRead avatar May 02 '25 20:05 MatthewRyanRead

@MatthewRyanRead Yes I tried it now, but it also resulted in seg fault error. 18.97 vite v5.4.14 building for production... 19.29 Segmentation fault (core dumped)

failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 139

amit11893 avatar May 05 '25 04:05 amit11893

@amit11893 For me, moving back to 2CPUs, 4Gib RAM from 4CPUs, 4Gib RAM for the colima VM fixed the 139 issues. I didn't find the root cause, but it might work for you too.

ionutleca avatar Aug 11 '25 14:08 ionutleca