Quickstart with Docker
Relevant source files
The following files were used as context for generating this wiki page:
FluentDo Agent can be quickly deployed using pre-built Docker images. This guide provides instructions for running the agent via Docker, including details on available images, configuration, and building from source. The agent is a hardened, stable, and secure downstream distribution of Fluent Bit, optimized for production deployments.
The provided Docker images are a fast way to start collecting and processing logs. They are available in multiple base distributions to fit different environments. For more advanced use cases, you can also build the images directly from the source code.
Sources: README.md:13-15, README.md:92-96
Available Docker Images
FluentDo Agent provides official Docker images based on different Linux distributions. The images are hosted on the GitHub Container Registry (ghcr.io).
| Image Name | Base Distribution | Description |
|---|---|---|
ghcr.io/fluentdo/agent/ubi | Red Hat Universal Base Image (UBI) | An image based on UBI, suitable for enterprise environments. |
ghcr.io/fluentdo/agent/debian | Debian | A distroless-style image based on Debian for a minimal footprint. |
The main tag for these images corresponds to the latest development builds from the main branch.
Sources: README.md:83-84, README.md:46, Dockerfile.ubi, Dockerfile.debian
Running the Agent
You can run the FluentDo Agent container using the docker run command. The following examples demonstrate how to run both the UBI and Debian-based images.
Basic Run Commands
To start the agent and mount a host directory for log collection, use the following commands.
UBI Image:
docker run --rm -it -v /var/log/containers:/var/log/containers:ro ghcr.io/fluentdo/agent/ubi:main -c /fluent-bit/etc/fluent-bit.yaml
Debian Image:
docker run --rm -it -v /var/log/containers:/var/log/containers:ro ghcr.io/fluentdo/agent/debian:main -c /fluent-bit/etc/fluent-bit.yaml
Sources: README.md:83-84
Command Breakdown
The diagram below illustrates the process of running the agent in Docker.
This diagram shows the steps from executing the docker run command to the agent actively reading logs.
Sources: README.md:83-84
The options used in the docker run command are explained in the table below.
| Option | Description |
|---|---|
--rm | Automatically removes the container when it exits. |
-it | Runs the container in interactive mode with a TTY. |
-v /var/log/containers:/var/log/containers:ro | Mounts the host's container log directory into the container in read-only (ro) mode. |
-c /fluent-bit/etc/fluent-bit.yaml | Specifies the configuration file for the agent to use inside the container. |
Sources: README.md:83-84
Permissions
Ensure that any files or directories mounted into the container are readable by the container's user. The user is defined in the Dockerfile. For example, in Dockerfile.ubi, the user is set with the USER instruction.
Sources: README.md:87, Dockerfile.ubi
Custom Configuration
To use a different configuration file, you can mount it from your host machine into the container and specify its path with the -c flag.
Example:
docker run --rm -it \
-v /path/to/my/custom-config.yaml:/my-config.yaml \
-v /var/log/containers:/var/log/containers:ro \
ghcr.io/fluentdo/agent/ubi:main -c /my-config.yaml
This command mounts a custom configuration file to /my-config.yaml inside the container and instructs the agent to use it.
Sources: README.md:89-90
Building Images from Source
If you need to customize the agent or build a specific version, you can build the Docker images from the source code.
Build Process
The following diagram outlines the steps to build the Docker images locally.
This diagram shows the workflow for building either the UBI or Debian-based Docker image from the cloned repository.
Sources: README.md:104-108
Build Commands
-
Clone the repository:
git clone https://github.com/FluentDo/agent.git cd agent -
Build the desired image:
- UBI Image:
docker build -f Dockerfile.ubi . - Debian Image:
docker build -f Dockerfile.debian .
- UBI Image:
These commands use the Dockerfiles in the root of the repository to build the container images locally. The project also provides a container-based build script for creating packages for specific Linux distributions.
Sources: README.md:98-100, README.md:104-108
Summary
The FluentDo Agent offers pre-built Docker images on UBI and Debian, enabling rapid deployment for log collection. Users can run these images with custom configurations by mounting their own files. For those needing customizations, the agent can also be easily built from source using the provided Dockerfiles. This flexibility makes it suitable for a wide range of production and development environments.
Sources: README.md:13-15, README.md:81-90, README.md:104-108