在Alpine Docker映像中安装fluent-bit

atmip9wb  于 2023-03-17  发布在  Docker
关注(0)|答案(2)|浏览(274)

如何将fluent-bit添加到基于docker:latest构建的映像中?
我已经试过了:

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"]

但是它没有找到/fluent-bit/bin/fluent-bit。我确实需要Python、Docker和所有其他指定的依赖项。

0lvr5msh

0lvr5msh1#

最后我在Python Debian映像中安装了docker和fluent-bit,它工作正常。

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"
j91ykkif

j91ykkif2#

Alpine Linux上没有官方的Fluent-bit Docker。
请查看官方手册。
Alpine Linux使用Musl C库而不是Glibc。Musl与Glibc不完全兼容,这在与Fluent Bit一起使用时会产生许多问题
因此,你需要将你的代码的软件包名称改为Debian的软件包。另外,链接显示你的一些软件包不能工作。
所以你需要找到Debian的等价物。例如,openssl-dev的Debian等价物是openssl-devel
之后,请将您的代码与official fluent-bit dockerfile合并。

相关问题