# fluent/fluent-bit-docker-image architecture

> Architecture diagram of the GitHub repository fluent/fluent-bit-docker-image, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fluent/fluent-bit-docker-image
- Repository: https://github.com/fluent/fluent-bit-docker-image

## Overview

##### Main Components
- Source Repository & Code Components:
- Dockerfiles targeting different architectures (arm32v7, arm64v8, x86_64, including specific versions like debug and master). These determine how the Docker images are built.
- Configuration files (located in the "conf" directory) which include various Fluent Bit configurations (standard parser configurations, plugin configurations, etc.).
- Hooks (in the "hooks" directory) that manage pre-build or post-checkout tasks to help build or verify the proper image configuration.
- Build Process:
- A docker build process that uses the repository contents (Dockerfiles + configuration + hooks) to produce production-grade container images. Note the distinction between the Distroless production image and the debug image (which includes Busybox).
- Container Runtime Environment:
- The resulting Docker image runs Fluent Bit, listening on TCP port 24224 with configurations for receiving and processing logs.
- The container outputs logs to stdout and can integrate with other Docker containers via the log-driver.

##### How to Organize These Components
a. Components and Their Labels:
- Repository Source: Labeled "Source Repository" with subdivisions for "Dockerfiles", "conf (Configurations)", and "hooks (Build/Checkout Scripts)".
- Build Pipeline: A labeled block indicating "Docker Build Process", illustrating the selection of the correct Dockerfile per target architecture and the incorporation of configuration and hook scripts.
- Container Image(s): Two main outputs:
- "Production Image" (based on Distroless with only the Fluent Bit binary and minimal libraries).
- "Debug Image" (includes Busybox for troubleshooting).
- Runtime Container: Labeled "Fluent Bit Container" showing that it listens on TCP port 24224 to accept forwarded logs.

b. Relationships and Data Flow:

c. Architectural Patterns and Technologies:
- Containerization principle: the whole system is designed as a Docker image with minimal dependencies in production.
- Multi-architecture support: multiple Dockerfiles for different platforms point to a decision for broad compatibility.
- Use of Distroless images in production for enhanced security.
- Optionally, mention that the debug variant uses Busybox to assist in troubleshooting.

- Use clear labels for each component (e.g., “Source Repository”, “Docker Build”, “Production Image”, “Debug Image”, “Fluent Bit Container”).

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Source Repository Group
  subgraph "Source Repository"
    SR["Source Repository"]:::repo
    subgraph "Dockerfiles"
      DF_arm32v7["Dockerfile.arm32v7"]:::repo
      DF_arm64v8["Dockerfile.arm64v8"]:::repo
      DF_x86_64["Dockerfile.x86_64"]:::repo
      DF_x86_64_debug["Dockerfile.x86_64-debug"]:::repo
      DF_x86_64_master["Dockerfile.x86_64-master"]:::repo
    end
    subgraph "Configurations"
      CFG_fluent["fluent-bit.conf"]:::repo
      CFG_parsers["parsers.conf"]:::repo
      CFG_parsers_amb["parsers_ambassador.conf"]:::repo
      CFG_parsers_cin["parsers_cinder.conf"]:::repo
      CFG_parsers_extra["parsers_extra.conf"]:::repo
      CFG_parsers_java["parsers_java.conf"]:::repo
      CFG_parsers_mult["parsers_mult.conf"]:::repo
      CFG_parsers_open["parsers_openstack.conf"]:::repo
      CFG_plugins["plugins.conf"]:::repo
    end
    subgraph "Hooks"
      Hook_Readme["README.md"]:::repo
      Hook_post["post_checkout"]:::repo
      Hook_pre["pre_build"]:::repo
    end
  end

  %% Build Process
  SR -->|"drives"| DSP["Docker Build Process"]:::build

  %% Build outputs
  DSP -->|"builds"| Prod["Production Image"]:::prod
  DSP -->|"builds"| Debug["Debug Image"]:::debug

  %% Feedback Loop from Debug (optional)
  Debug -->|"debug feedback"| DSP

  %% Deployment to Runtime Container
  Prod -->|"deploys"| Runtime["Fluent Bit Container (Port 24224)"]:::runtime
  Debug -->|"deploys"| Runtime

  %% External Interactions
  External["External Systems/Docker Containers"]:::external
  Logs["Log Consumers"]:::external
  External -->|"forwards_logs"| Runtime
  Runtime -->|"stdout_logs"| Logs

  %% Click Events for Dockerfiles
  click DF_arm32v7 "https://github.com/fluent/fluent-bit-docker-image/blob/master/Dockerfile.arm32v7"
  click DF_arm64v8 "https://github.com/fluent/fluent-bit-docker-image/blob/master/Dockerfile.arm64v8"
  click DF_x86_64 "https://github.com/fluent/fluent-bit-docker-image/blob/master/Dockerfile.x86_64"
  click DF_x86_64_debug "https://github.com/fluent/fluent-bit-docker-image/blob/master/Dockerfile.x86_64-debug"
  click DF_x86_64_master "https://github.com/fluent/fluent-bit-docker-image/blob/master/Dockerfile.x86_64-master"

  %% Click Events for Configuration Files
  click CFG_fluent "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/fluent-bit.conf"
  click CFG_parsers "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers.conf"
  click CFG_parsers_amb "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_ambassador.conf"
  click CFG_parsers_cin "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_cinder.conf"
  click CFG_parsers_extra "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_extra.conf"
  click CFG_parsers_java "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_java.conf"
  click CFG_parsers_mult "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_mult.conf"
  click CFG_parsers_open "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/parsers_openstack.conf"
  click CFG_plugins "https://github.com/fluent/fluent-bit-docker-image/blob/master/conf/plugins.conf"

  %% Click Events for Hooks
  click Hook_Readme "https://github.com/fluent/fluent-bit-docker-image/blob/master/hooks/README.md"
  click Hook_post "https://github.com/fluent/fluent-bit-docker-image/tree/master/hooks/post_checkout"
  click Hook_pre "https://github.com/fluent/fluent-bit-docker-image/tree/master/hooks/pre_build"

  %% Styles
  classDef repo fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
  classDef build fill:#ABEBC6,stroke:#196F3D,stroke-width:2px;
  classDef prod fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
  classDef debug fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
  classDef runtime fill:#D6EAF8,stroke:#2471A3,stroke-width:2px;
  classDef external fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
```
