gpt4 book ai didi

docker - 如何让 Docker 识别 ffmpeg?

转载 作者:行者123 更新时间:2023-12-04 23:13:50 29 4
gpt4 key购买 nike

我的容器旨在成为一个 celery worker ,其任务依赖于 ImageMagick 和 FFMPEG。这构建没有问题。此外,如果我运行(注释掉)CMD celery ,然后 celery 开始没有问题。然后它无法找到 ffmpeg。
CMD ffmpeg命令测试它并且当前只返回 /bin/sh: 1: ffmpeg: not found .我该如何解决?

FROM alpine:latest

RUN apk add --update ffmpeg

FROM python:3.7

WORKDIR /
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt

RUN apt-get install imagemagick

COPY . /
WORKDIR /

# Run celery.py when the container launches. Commented out to test ffmpeg.
# CMD ["celery", "worker", "-A", "a.celery", "--loglevel=info"]
CMD ffmpeg

如果我改为执行以下操作,它会起作用:
FROM alpine:latest

RUN apk add --update ffmpeg

CMD ffmpeg

最佳答案

问题是图书馆没有被链接。以下作品:

FROM python:3.7

# This below is sufficient by itself to yield ffmpeg. However, we want to use
# the jrottenberg version.
# COPY --from=mwader/static-ffmpeg:4.1.4-2 /ffmpeg /ffprobe /usr/local/bin/

# jrottenberg version
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY --from=jrottenberg/ffmpeg /usr/local /usr/local/

WORKDIR /
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt

RUN apt-get install imagemagick

COPY . /
WORKDIR /

CMD ffmpeg

关于docker - 如何让 Docker 识别 ffmpeg?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57233036/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com