Fluentd is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data.
These tags have image version postfix.
v1.3.2-1.0
,v1.3-1
,edge
(v1.3/alpine/Dockerfile)v1.3.2-onbuild-1.0
,v1.3-onbuild-1
,edge-onbuild
(v1.3/alpine-onbuild/Dockerfile)v1.3.2-debian-1.0
,v1.3-debian-1
,edge-debian
(v1.3/debian/Dockerfile)v1.3.2-debian-onbuild-1.0
,v1.3-debian-onbuild-1
,edge-debian-onbuild
(v1.3/debian-onbuild/Dockerfile)v0.12.43-1.0
,v0.12-1
(v0.12/alpine/Dockerfile)v0.12.43-onbuild-1.0
,v0.12-onbuild-1
(v0.12/alpine-onbuild/Dockerfile)v0.12.43-debian-1.0
,v0.12-debian-1
(v0.12/debian/Dockerfile)v0.12.43-debian-onbuild-1.0
,v0.12-debian-onbuild-1
(v0.12/debian-onbuild/Dockerfile)
v1.3.2
,v1.3
,stable
,latest
(v1.3/alpine/Dockerfile)v1.3.2-onbuild
,v1.3-onbuild
,stable-onbuild
,onbuild
(v1.3/alpine-onbuild/Dockerfile)v1.3.2-debian
,v1.3-debian
,stable-debian
,debian
(v1.3/debian/Dockerfile)v1.3.2-debian-onbuild
,v1.3-debian-onbuild
,stable-debian-onbuild
, (v1.3/debian-onbuild/Dockerfile)v0.12.43
,v0.12
(v0.12/alpine/Dockerfile)v0.12.43-onbuild
,v0.12-onbuild
(v0.12/alpine-onbuild/Dockerfile)v0.12.43-debian
,v0.12-debian
(v0.12/debian/Dockerfile)v0.12.43-debian-onbuild
,v0.12-debian-onbuild
(v0.12/debian-onbuild/Dockerfile)
We recommend to use debian version for production because it uses jemalloc to mitigate memory fragmentation issue.
v1.x is for fluentd v1.x releases. This is current stable version. v0.12 is for fluentd v0.12.x releases. This is old stable.
You can use older versions via tag. See tag page on Docker Hub.
Check fluentd-kubernetes-daemonset images.
This image is based on the popular Alpine Linux project, available in the alpine official image, and Debian images.
Latest version of edge Fluentd branch (currently v1.3-1
).
Latest version of vX.Y
Fluentd branch.
A
will be incremented when image has breaking changes.
Concrete vX.Y.Z
version of Fluentd.
A
will be incremented when image has breaking changes.
B
will be incremented when image has non-breaking changes, e.g. library update or bug fixes.
This image makes building derivative images easier. See "How to build your own image" section for more details.
The image based on Debian Linux image.
You may use this image when you require plugins which cannot be installed on Alpine (like fluent-plugin-systemd
).
The armhf
images use ARM base images for use on devices such as Raspberry Pis.
Furthermore, the base images enable support for cross-platform builds using the cross-build tools from resin.io.
In order to build these images natively on ARM devices, the CROSS_BUILD_START
and CROSS_BUILD_END
Docker build arguments must be set to the shell no-op (:
), for example:
docker build --build-arg CROSS_BUILD_START=":" --build-arg CROSS_BUILD_END=":" -t fluent/fluentd:v1.3.2-onbuild v1.3/armhf/alpine-onbuild
(assuming the command is run from the root of this repository).
Latest version of stable Fluentd branch (currently v1.3
).
Latest version of vX.Y
Fluentd branch.
Concrete vX.Y.Z
version of Fluentd.
Same as current images.
To create endpoint that collects logs on your host just run:
docker run -d -p 24224:24224 -p 24224:24224/udp -v /data:/fluentd/log fluent/fluentd:v1.3-debian
Default configurations are to:
- listen port
24224
for Fluentd forward protocol - store logs with tag
docker.**
into/fluentd/log/docker.*.log
(and symlinkdocker.log
) - store all other logs into
/fluentd/log/data.*.log
(and symlinkdata.log
)
fluentd
arguments can be appended to the docker run
line
For example, to provide a bespoke config and make fluentd
verbose, then:
docker run -ti --rm -v /path/to/dir:/fluentd/etc fluentd -c /fluentd/etc/<conf> -v
The first -v
tells Docker to share '/path/to/dir' as a volume and mount it at /fluentd/etc
The -c
after the container name (fluentd) tells fluentd
where to find the config file
The second -v
is passed to fluentd
to tell it to be verbose
You can build a customized image based on Fluentd's onbuild
image.
Customized image can include plugins and fluent.conf
file.
We will use this directory to build a Docker image. Type following commands on a terminal to prepare a minimal project first:
# Create project directory.
mkdir custom-fluentd
cd custom-fluentd
# Download default fluent.conf. This file will be copied to the new image.
# VERSION is v1.3 or v0.12 like fluentd version and OS is alpine or debian.
# Full example is https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/v0.12/debian-onbuild/fluent.conf
curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/VERSION/OS-onbuild/fluent.conf > fluent.conf
# Create plugins directory. plugins scripts put here will be copied to the new image.
mkdir plugins
# Download sample Dockerfile. If you use v0.14.15/v0.12.34 or earlier image, use Dockerfile.sample.old
curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/Dockerfile.sample > Dockerfile
Documentation of fluent.conf
is available at docs.fluentd.org.
You can install Fluentd plugins using Dockerfile.
Sample Dockerfile installs fluent-plugin-elasticsearch
.
To add plugins, edit Dockerfile
as following:
# or v0.12-onbuild
FROM fluent/fluentd:v1.3-onbuild
# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
sudo build-base ruby-dev \
&& sudo gem install \
fluent-plugin-elasticsearch \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /home/fluent/.gem/ruby/2.5.0/cache/*.gem
COPY fluent.conf /fluentd/etc/
COPY entrypoint.sh /bin/
# or v0.12-debian-onbuild
FROM fluent/fluentd:v1.3-debian-onbuild
# below RUN includes plugin as examples elasticsearch is not required
# you may customize including plugins as you wish
RUN buildDeps="sudo make gcc g++ libc-dev ruby-dev" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& sudo gem install \
fluent-plugin-elasticsearch \
&& sudo gem sources --clear-all \
&& SUDO_FORCE_REMOVE=yes \
apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/* \
/home/fluent/.gem/ruby/2.3.0/cache/*.gem
These example run apk add
/apt-get install
to be able to install
Fluentd plugins which require native extensions (they are removed immediately
after plugin installation).
If you're sure that plugins don't include native extensions, you can omit it
to make image build faster.
Use docker build
command to build the image.
This example names the image as custom-fluentd:latest
:
docker build -t custom-fluentd:latest ./
Once the image is built, it's ready to run.
Following commands run Fluentd sharing ./log
directory with the host machine:
mkdir -p log
docker run -it --rm --name custom-docker-fluent-logger -v $(pwd)/log:/fluentd/log custom-fluentd:latest
Open another terminal and type following command to inspect IP address. Fluentd is running on this IP address:
docker inspect -f '{{.NetworkSettings.IPAddress}}' custom-docker-fluent-logger
Let's try to use another docker container to send its logs to Fluentd.
docker run --log-driver=fluentd --log-opt tag="docker.{{.ID}}" --log-opt fluentd-address=FLUENTD.ADD.RE.SS:24224 python:alpine echo Hello
# and force flush buffered logs
docker kill -s USR1 custom-docker-fluent-logger
(replace FLUENTD.ADD.RE.SS
with actual IP address you inspected at
the previous step)
You will see some logs sent to Fluentd.
Fluentd logging driver - Docker Docs
We can't notice comments in the DockerHub so don't use them for reporting issue or asking question.
If you have any problems with or questions about this image, please contact us through a GitHub issue.