1

A container described in docker-compose.yml uses logging extension to send log to a fluentd container.

version: "2"

services:

  fluentd:
    image: fluent/fluentd:v0.14.8
    container_name: fluentd

  nginx:
    image: nginx:1.11.5
    container_name: nginx
    links:
      - fluentd
    logging:
      driver: fluentd
      options:
        fluentd-address: fluentd:24224

But this configuration does not work, as the fluentd-address is seen externally by the host (aka the host) and not from within the nginx container.

So it requires a way to know the IP address of container outside the container but in a compatible way for docker-compose, any idea ?

Kartoch
  • 233
  • 4
  • 14

1 Answers1

4

With the latest docker-compose it wont work on links, you need to use docker networks.

And actually you can omit the fluentd-address because fluentd log driver autodiscover for anyting that listening on 24224 in that case

version: "2"
services:
  fluentd:
    image: fluent/fluentd:v0.14.8
    container_name: fluentd
    networks:
      - nw-01

  nginx:
    image: nginx:1.11.5
    container_name: nginx
    networks:
      - nw-01
    logging:
      driver: fluentd
networks:
  nw-01:
    external: true
neveragny
  • 56
  • 3