/note/tech

docker-composeでfluent-bitコンテナにログを転送しようとするとエラーが発生する件について

やりたいこと

version: '3.8'
services:
    fluent-bit:
        container_name: fluent-bit
        image: fluent/fluent-bit
        command: ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
        volumes:
            - ./fluent-bit.conf:/fluent-bit/etc/fluent-bit.conf
            - ./parsers.conf:/fluent-bit/etc/parsers.conf
    http-echo:
        image: hashicorp/http-echo:latest
        command: ['-text', 'Hello World', '-listen', ':8080']
        ports:
            - 8080:8080
        depends_on:
            - fluent-bit
        logging:
            driver: "fluentd"
            options:
                fluentd-address: fluent-bit:24224
                tag: "docker.logging_driver.mylog"

[SERVICE]
    Flush        5
    Daemon       Off
    Log_Level    info
    Parsers_File parsers.conf
    Plugins_File plugins.conf

[INPUT]
    Name forward
    Host 0.0.0.0
    Listen 0.0.0.0
    Port 24224

[OUTPUT]
    Name  stdout
    Match *
    Format json_lines

現象

ERROR: for fluent-bit_http-echo_1  Cannot start service http-echo: failed to initialize logging driver: dial tcp: lookup fluent-bit: Temporary failure in name resolution

ERROR: for http-echo  Cannot start service http-echo: failed to initialize logging driver: dial tcp: lookup fluent-bit: Temporary failure in name resolution
ERROR: Encountered errors while bringing up the project.

期待する動作

試したこと(1)

logging:
    driver: "fluentd"
    options:
        fluentd-address: fluent-bit:24224
        fluentd-async-connect: 'true'
        fluentd-retry-wait: '2000ms'
        fluentd-max-retries: '30'
        tag: "docker.logging_driver.mylog"

試したこと(2)

試したこと(3)

ports:
    - 24224:24224
    - 24224:24224/udp

暫定的な対策

ports:
    - 127.0.0.1:24224:24224
    - 127.0.0.1:24224:24224/udp

logging:
    driver: "fluentd"
    options:
        fluentd-address: localhost:24224

参考資料