> For the complete documentation index, see [llms.txt](https://docs.fluentd.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fluentd.org/0.12/container-deployment/install-by-docker.md).

# Docker Image

This article explains how to use [Fluentd's official Docker image](https://hub.docker.com/r/fluent/fluentd/), maintained by [Treasure Data, Inc](http://www.treasuredata.com/).

* [Fluentd's official Docker image](https://hub.docker.com/r/fluent/fluentd/)
* [Fluentd's official Docker image (Source)](https://github.com/fluent/fluentd-docker-image)

## Step 0: Install Docker

Please download and install [Docker](https://www.docker.com/) from here.

* [Docker Installation](https://docs.docker.com/engine/installation/)

## Step 1: Pull Fluentd's Docker image

Then, please download Fluentd v0.12's image by `docker pull` command.

```
$ docker pull fluent/fluentd:v0.12-debian
```

Debian and Alpine Linux version is available for Fluentd image. Debian version is recommended officially since it has jemalloc support, however Alpine image is smaller.

## Step 2: Launch Fluentd Container

To make the test simple, create the example config below at `/tmp/fluentd.conf`. This example accepts records from http, and output to stdout.

```
# /tmp/fluentd.conf
<source>
  @type http
  port 9880
  bind 0.0.0.0
</source>
<match **>
  @type stdout
</match>
```

Finally, you can run Fluentd with `docker run` command.

```
$ docker run -d \
  -p 9880:9880 -v /tmp:/fluentd/etc -e FLUENTD_CONF=fluentd.conf \
  fluent/fluentd
2017-01-30 11:52:23 +0000 [info]: reading config file path="/fluentd/etc/fluentd.conf"
2017-01-30 11:52:23 +0000 [info]: starting fluentd-0.12.31
2017-01-30 11:52:23 +0000 [info]: gem 'fluentd' version '0.12.31'
2017-01-30 11:52:23 +0000 [info]: adding match pattern="**" type="stdout"
2017-01-30 11:52:23 +0000 [info]: adding source type="http"
2017-01-30 11:52:23 +0000 [info]: using configuration file: <ROOT>
  <source>
    @type http
    port 9880
    bind 0.0.0.0
  </source>
  <match **>
    @type stdout
  </match>
</ROOT>
```

## Step3: Post Sample Logs via HTTP

Let's post sample logs via HTTP and confirm it's working. `curl` command is always your friend.

```
$ curl -X POST -d 'json={"json":"message"}' http://localhost:9880/sample.test
```

Use `docker ps` command to retrieve container ID, and use `docker logs` command to check the specific container's log.

```
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                         NAMES
b495e527850c        fluent/fluentd      "/bin/sh -c 'exec ..."   2 hours ago         Up 2 hours          5140/tcp, 24224/tcp, 0.0.0.0:9880->9880/tcp   awesome_mcnulty
$ docker logs b495e527850c | tail -n 1
2017-01-30 14:04:37 +0000 sample.test: {"json":"message"}
```

## Next Steps

Now you know how to use Fluentd via Docker. Here're a couple of Docker related documentations for Fluentd.

* [Fluentd's official Docker image](https://hub.docker.com/r/fluent/fluentd/)
* [Fluentd's official Docker image (Source)](https://github.com/fluent/fluentd-docker-image)
* [Docker Logging Driver and Fluentd](/0.12/articles/docker-logging.md)
* [Docker Logging via EFK (Elasticsearch + Fluentd + Kibana) Stack with Docker Compose](/0.12/articles/docker-logging-efk-compose.md)

Also, please see the following tutorials to learn how to collect your data from various data sources.

* Basic Configuration
  * [Config File](/0.12/configuration/config-file.md)
* Application Logs
  * [Ruby](/0.12/articles/ruby.md), [Java](/0.12/articles/java.md), [Python](/0.12/articles/python.md), [PHP](/0.12/articles/php.md),

    [Perl](/0.12/articles/perl.md), [Node.js](/0.12/articles/nodejs.md), [Scala](/0.12/articles/scala.md)
* Examples
  * [Store Apache Log into Amazon S3](/0.12/articles/apache-to-s3.md)
  * [Store Apache Log into MongoDB](/0.12/articles/apache-to-mongodb.md)
  * [Data Collection into HDFS](/0.12/articles/http-to-hdfs.md)

If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is a open source project under [Cloud Native Computing Foundation (CNCF)](https://cncf.io/). All components are available under the Apache 2 License.
