skip to Main Content

How can I add fluent-bit to an image that builds on docker:latest?

I have tried this:

FROM docker:latest

RUN apk add python3 py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make curl libc6-compat
RUN apk add --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/

ENTRYPOINT ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]

But it does not find /fluent-bit/bin/fluent-bit. I do need Python, Docker, and all the other specified dependencies.

2

Answers


  1. Chosen as BEST ANSWER

    I ended up installing docker and fluent-bit in a Python Debian image, and it works. Dockerfile:

    FROM python:3.11-slim-buster
    
    # install dependencies
    RUN apt-get update
    RUN apt-get upgrade
    RUN apt-get install -y curl bash gpg
    
    # install fluent-bit
    RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
    
    ENV PATH="/opt/fluent-bit/bin:${PATH}"
    
    # install concurrently
    RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
    RUN apt install nodejs
    RUN npm install --global concurrently
    
    # install docker
    RUN apt update
    RUN apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
    RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
    RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
    RUN apt update
    RUN apt-cache policy docker-ce
    RUN apt install -y docker-ce
    
    # set up custom files
    RUN mkdir -p /app
    RUN mkdir -p /logs
    
    COPY uploader/sync.py /app/sync.py
    COPY uploader/entrypoint.sh /app/entrypoint.sh
    
    RUN chmod +x /app/entrypoint.sh
    
    ENTRYPOINT /app/entrypoint.sh
    
    

    entrypoint.sh:

    command1="python3 /app/sync.py --compose_project_name $COMPOSE_PROJECT_NAME"
    command2="/opt/fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf"
    concurrently "$command1" "$command2"
    
    

  2. There is no official Fluent-bit docker on Alpine Linux.

    Please, Check the official manual.

    Alpine Linux uses Musl C library instead of Glibc. Musl is not fully compatible with Glibc which generated many issues when used with Fluent Bit

    Therefore, you need to change your code’s package name to Debian’s package. Also, the link shows some packages of yours won’t work.

    So you need to find Debian equivalents.
    For example,
    openssl-dev‘s Debian equivalent is openssl-devel.

    After that, please, merge your code with the official fluent-bit dockerfile.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search