Install inotify-tools in runtime image instead of build stage#26
Merged
Install inotify-tools in runtime image instead of build stage#26
Conversation
**Problem**: The Dockerfile installs `inotify-tools` in the `build` stage,
which uses `--platform=$BUILDPLATFORM` (always the build host's architecture,
typically x86-64). The inotifywait binary and libinotifytools.so.0 are then
`COPY --from=build` into the runtime image. On ARM64 nodes, the x86-64 binary
cannot execute — busybox sh falls back to interpreting the ELF as a shell
script, producing `syntax error: unexpected "("`. The dynamic linker
`/lib64/ld-linux-x86-64.so.2` is missing; only
`/lib/ld-linux-aarch64.so.1` exists. This silently breaks all inotifywait-based
config reload in postgres-exporter on ARM64.
**Solution**: Remove `inotify-tools` from the build stage and install it via
`apk --no-cache add inotify-tools` in the runtime stage instead. The runtime
stage uses the target platform, so ARM64 builds get an ARM64 inotifywait. Remove
the two `COPY --from=build` lines for `/bin/inotifywait` and
`/lib/libinotifytools.so.0` since the package manager handles installation.
**Testing**: Needs a multi-arch image build to verify ARM64 inotifywait works.
fatih
approved these changes
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: The Dockerfile installs
inotify-toolsin thebuildstage,which uses
--platform=$BUILDPLATFORM(always the build host's architecture,typically x86-64). The inotifywait binary and libinotifytools.so.0 are then
COPY --from=buildinto the runtime image. On ARM64 nodes, the x86-64 binarycannot execute — busybox sh falls back to interpreting the ELF as a shell
script, producing
syntax error: unexpected "(". The dynamic linker/lib64/ld-linux-x86-64.so.2is missing; only/lib/ld-linux-aarch64.so.1exists. This silently breaks all inotifywait-basedconfig reload in postgres-exporter on ARM64.
Solution: Remove
inotify-toolsfrom the build stage and install it viaapk --no-cache add inotify-toolsin the runtime stage instead. The runtimestage uses the target platform, so ARM64 builds get an ARM64 inotifywait. Remove
the two
COPY --from=buildlines for/bin/inotifywaitand/lib/libinotifytools.so.0since the package manager handles installation.Security Impact:
None. Same package, installed from the same apk repository, just in the correct build stage. No new privileges or dependencies.
Testing:
linux/amd64,linux/arm64) verifies ARM64 inotifywait is present and executable — runs automatically on merge to main viabuild.yml, so will test there.