#20751: fix: zfs dockerfile pnpm hardlink
docker
size: XS
Cluster:
Docker Enhancements and Fixes
## Summary
- **Problem:** Docker build fails on ZFS with `EAGAIN: resource temporarily unavailable` during `pnpm install`
- **Root cause:** pnpm's `auto` import method detection fails on ZFS, falls back to `copy`, and `copyfile()` has issues on ZFS (pnpm/pnpm#5803 — open for over a year)
- **Fix:** Force `--package-import-method=hardlink` to bypass the broken detection
- **Scope:** Single-line change to Dockerfile, no runtime behavior affected
## Change Type
- [x] Bug fix
## Scope
- [x] CI/CD / infra
## Linked Issue
- Closes #5661
- Related: pnpm/pnpm#5803 (upstream ZFS issue, unresolved)
## User-visible / Behavior Changes
None. Docker builds on ZFS now succeed.
## Security Impact
- New permissions/capabilities? **No**
- Secrets/tokens handling changed? **No**
- New/changed network calls? **No**
- Command/tool execution surface changed? **No**
- Data access scope changed? **No**
## Why this workaround?
The upstream pnpm issue (pnpm/pnpm#5803) has been open since Oct 2023 with no fix. Multiple reports confirm the issue on:
- ZFS (Linux, FreeBSD)
- Docker Desktop on macOS (gRPC FUSE, VirtioFS)
- Dev containers with volume mounts
The `hardlink` method works on all major Linux filesystems (ext4, XFS, ZFS, btrfs, overlay2) and avoids the problematic `copyfile()` path entirely. For this Dockerfile (no BuildKit cache mounts, single-layer build), `hardlink` is safe and has no performance penalty.
## Evidence
- Issue reporter confirmed fix works: [hoppscotch/hoppscotch#4960](https://github.com/hoppscotch/hoppscotch/issues/4960#issuecomment-2780903150)
- Same workaround used by multiple projects facing the same issue
## Compatibility / Migration
- Backward compatible? **Yes**
- Config/env changes? **No**
- Migration needed? **No**
## Risks and Mitigations
- **Risk:** None for this Dockerfile. Hardlink works on overlay2 (Docker's default) and all common Linux filesystems.
- **Note:** `hardlink` would fail if store and node_modules were on different filesystems (e.g., BuildKit cache mounts), but this Dockerfile doesn't use cache mounts.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds `--package-import-method=hardlink` flag to `pnpm install` in the main Dockerfile to fix build failures on ZFS filesystems.
The change addresses a known pnpm issue (pnpm/pnpm#5803) where pnpm's automatic filesystem detection fails on ZFS, causing `EAGAIN: resource temporarily unavailable` errors during `copyfile()` operations. By forcing hardlink mode, the Dockerfile bypasses the problematic copy method entirely.
- Single-line change to Dockerfile:24
- No runtime behavior changes
- Compatible with Docker's overlay2 filesystem and common Linux filesystems (ext4, XFS, btrfs, ZFS)
- Note: The test in `src/dockerfile.test.ts:12` checks for the exact string `"RUN pnpm install --frozen-lockfile"` and will need updating to match the new command with the additional flag
<h3>Confidence Score: 4/5</h3>
- Safe to merge after fixing the test - the Dockerfile change is minimal and well-justified
- The change is a minimal, well-documented workaround for a known upstream issue. The approach is validated by external reports and safe for Docker's overlay2 filesystem. However, the test in `src/dockerfile.test.ts:12` will fail because it searches for an exact string that no longer matches the updated command. Once the test is updated, this is safe to merge.
- Update `src/dockerfile.test.ts` to match the new pnpm command
<sub>Last reviewed commit: 55b511f</sub>
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#3240: Fix Docker build failures on Windows/WSL environments
by Attili-sys · 2026-01-28
76.6%
#11818: fix(docker): resolve build hang by using in-place ownership and opt...
by dilly · 2026-02-08
76.3%
#17151: fix: add npm link to fix CLI permission denied (exit 127)
by sskyu · 2026-02-15
75.0%
#6631: fix: configure npm global prefix for non-root user in Docker
by tjetzinger · 2026-02-01
74.5%
#13737: Docker: harden UID/GID remap and docker-setup flow, convenience upd...
by ramarnat · 2026-02-10
73.1%
#2609: bugfix: Docker build fails on main: .dockerignore excludes required...
by yanquankun · 2026-01-27
72.8%
#5458: fix: set correct file ownership in Dockerfile (#5450)
by hakyonglee · 2026-01-31
72.6%
#19807: fix: apply #19779 Docker/TS strict-build fixes
by dalefrieswthat · 2026-02-18
71.6%
#4238: Fix/docker migration atomicity
by ricardotrevisan · 2026-01-29
71.5%
#19172: fix(docker): prevent HTTPS downgrade in curl commands
by govind-amt · 2026-02-17
71.5%