在多阶段Docker构建中复制ffmpeg容器 [英] Copy ffmpeg bins in multistage docker build

查看:471
本文介绍了在多阶段Docker构建中复制ffmpeg容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过多阶段docker build安装ffmpeg

I'm trying to install ffmpeg via a multistage docker build

这是包含ffmpeg二进制文件的ffmpeg映像

Here is the ffmpeg image that contains the ffmpeg binaries

FROM jrottenberg/ffmpeg

这是我需要运行Web服务器的pm2映像

Here is the pm2 image that I need to run my web server

FROM keymetrics/pm2:8-alpine

我将垃圾箱复制到当前映像中,可以看到ffmpeg,ffserver和ffprobe都存在于/ usr / local / bin中

I copy the bins into the current image, and I can see that ffmpeg, ffserver, and ffprobe all exist in /usr/local/bin.

COPY --from=0 /usr/local /usr/local

复制命令似乎成功,因为当我交互式运行容器时,这些文件存在。

The copy command appears to succeed, since those files exist when I run the container interactively.

$# which ffmpeg
/usr/local/bin/ffmpeg

但是,当我尝试运行垃圾箱时,它说未找到命令。

However, when I try running the bins, it says the command isn't found.

$# ffmpeg --version
/bin/sh: ffmpeg: not found


推荐答案

我遇到了类似的问题,最终使用支持构建静态 PIE二进制文件的高山gcc工具链构建了没有依赖性的我自己的二进制文件。原因是我不需要依赖项,无需构建,也支持ASLR。

I've had a similar issue and ended up building my own binaries with no dependencies using the alpine gcc toolchain that supports building "static" PIE binaries. The reason was that I wanted no dependencies, hardened build and also support ASLR.

> https://hub.docker.com/r/mwader/static-ffmpeg/

这篇关于在多阶段Docker构建中复制ffmpeg容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆