Skip to content

Instantly share code, notes, and snippets.

@luccabb
Created September 3, 2026 01:57
Show Gist options
  • Select an option

  • Save luccabb/20104d60d77b76d37f8b292c877ff2c0 to your computer and use it in GitHub Desktop.

Select an option

Save luccabb/20104d60d77b76d37f8b292c877ff2c0 to your computer and use it in GitHub Desktop.
fluent-bit for arm64 64 KiB-page kernels (NVIDIA Grace): build with -DFLB_JEMALLOC=Off so it uses glibc malloc
# syntax=docker/dockerfile:1
#
# fluent-bit for linux/arm64 with jemalloc DISABLED, so it runs on 64 KiB-page kernels
# (NVIDIA Grace and other aarch64 "-64k" kernels, where `getconf PAGESIZE` = 65536).
#
# WHY: every official cr.fluentbit.io/fluent/fluent-bit arm64 image (tested through 5.1.1)
# statically links a jemalloc built for 4 KiB pages. On a 64 KiB-page kernel jemalloc aborts
# at init -> `<jemalloc>: Unsupported system page size` -> every malloc() fails -> fluent-bit
# dies while parsing its config.
#
# FIX: build upstream fluent-bit from source with -DFLB_JEMALLOC=Off. It then uses glibc
# malloc, which has no compile-time page-size assumption, so one image runs on both 4 KiB
# and 64 KiB kernels (and sidesteps jemalloc now being archived). Bump FLB_VERSION as needed.
#
# Build: docker buildx build --platform linux/arm64 -t <you>/fluent-bit:${FLB_VERSION}-arm64-64k .
# Smoke on a 64 KiB node (must print the banner + records, ZERO "Unsupported system page size"):
# /fluent-bit/bin/fluent-bit -i dummy -o stdout -f 1
ARG FLB_VERSION=3.1.9
########################################################################
# Build stage
########################################################################
FROM ubuntu:24.04 AS build
ARG FLB_VERSION
ARG MAKE_JOBS=
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake make git ca-certificates pkg-config \
flex bison libssl-dev libsasl2-dev libsystemd-dev zlib1g-dev libyaml-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 -b "v${FLB_VERSION}" https://github.com/fluent/fluent-bit /src/fluent-bit
WORKDIR /src/fluent-bit/build
# Upstream release flags, except FLB_JEMALLOC=Off (the whole point of this image).
RUN cmake \
-DFLB_RELEASE=On \
-DFLB_JEMALLOC=Off \
-DFLB_TLS=On \
-DFLB_SHARED_LIB=Off \
-DFLB_EXAMPLES=Off \
-DFLB_HTTP_SERVER=On \
-DFLB_IN_SYSTEMD=On \
-DFLB_OUT_KAFKA=On \
-DFLB_IN_TAIL=On \
-DFLB_FILTER_KUBERNETES=On \
-DFLB_OUT_S3=On \
-DFLB_OUT_HTTP=On \
-DFLB_OUT_STDOUT=On \
.. \
&& grep FLB_JEMALLOC CMakeCache.txt
RUN make -j"${MAKE_JOBS:-$(nproc)}"
RUN install -D -m 0755 bin/fluent-bit /fluent-bit/bin/fluent-bit \
&& mkdir -p /fluent-bit/etc /fluent-bit/log \
&& cp ../conf/fluent-bit.conf ../conf/parsers*.conf ../conf/plugins.conf /fluent-bit/etc/ \
&& /fluent-bit/bin/fluent-bit --version
########################################################################
# Runtime stage
########################################################################
FROM ubuntu:24.04
ARG FLB_VERSION
LABEL org.opencontainers.image.title="Fluent Bit (jemalloc disabled, 64K-page safe)" \
org.opencontainers.image.version="${FLB_VERSION}-arm64-64k" \
org.opencontainers.image.source="https://github.com/fluent/fluent-bit" \
org.opencontainers.image.licenses="Apache-2.0"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libssl3t64 libsasl2-2 libsystemd0 zlib1g libyaml-0-2 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /fluent-bit /fluent-bit
RUN ldd /fluent-bit/bin/fluent-bit && ! ldd /fluent-bit/bin/fluent-bit | grep -q 'not found' \
&& /fluent-bit/bin/fluent-bit --version
EXPOSE 2020
ENTRYPOINT ["/fluent-bit/bin/fluent-bit"]
CMD ["-c", "/fluent-bit/etc/fluent-bit.conf"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment