Fluentd Docker images based on Alpine Linux
1.3K
Docker images for Fluentd
Fluentd is an open source data collector, which lets you unify the data collection and consumption for a better use and understanding of data.

To create endpoint that collectc logs on your host just run:
docker run -d -p 24224:24224 -v /data:/fluentd/log fluent/fluentd
Default configurations are to:
24224 for Fluentd forward protocoldocker.** into /fluentd/log/docker.*.log
(and symlink docker.log)/fluentd/log/data.*.log (and symlink data.log)Environment variable below are configurable to control how to execute fluentd process:
FLUENTD_CONFThis variable allows you to specify configuration file name that will be used
in -c Fluentd command line option.
If you want to use your own configuration file (without any optional plugins),
you can do it with this environment variable and Docker volumes (-v option
of docker run).
yours.conf.docker run with -v /path/to/dir:/fluentd/etc
to share /path/to/dir/yours.conf in container,
and -e FLUENTD_CONF=yours.conf to read it.FLUENTD_OPTUse this variable to specify other Fluentd command line options,
like -v or -q.
This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
Since v0.12.26, tags are separated into vX.Y.Z and vX.Y.Z-onbuild.
stable, latestLatest version of stable Fluentd branch (currently v0.12).
edgeLatest version of edge Fluentd branch (currently v0.14).
vX.YLatest version of vX.Y Fluentd branch.
vX.Y.ZConcrete vX.Y.Z version of Fluentd.
onbuild, xxx-onbuildThis image makes building derivative images easier.
See "How to build your own image" section for
more details.
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.
curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/fluent.conf > fluent.conf
# Create plugins directory. plugins scripts put here will be copied to the new image.
mkdir plugins
# Download sample Dockerfile.
curl https://raw.githubusercontent.com/fluent/fluentd-docker-image/master/Dockerfile.sample > Dockerfile
fluent.confDocumentation of fluent.conf is available at docs.fluentd.org.
You can install Fluentd plugins using Dockerfile.
Sample Dockerfile installs fluent-plugin-elasticsearch and
fluent-plugin-record-reformer.
To add plugins, edit Dockerfile as following:
FROM bandsintown/alpine:3.4
USER root
RUN apk add --update --virtual .build-deps \
sudo build-base ruby-dev \
# cutomize following instruction as you wish
&& sudo -u fluent gem install \
fluent-plugin-elasticsearch \
fluent-plugin-record-reformer \
&& sudo -u fluent gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* \
/home/fluent/.gem/ruby/2.3.0/cache/*.gem
USER fluent
EXPOSE 24284
These example run apk add 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 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 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.
Content type
Image
Digest
Size
28.3 MB
Last updated
over 9 years ago
docker pull bandsintown/fluentd