您好,我正在使用以下 docker 映像:
from golang:alpine3.18
使用 ffmpeg:(可能在这里我遗漏了一些东西)
run apk add --no-cache ffmpeg
但是当尝试执行以下操作时:
cmd := "ffmpeg -i untitled.mp4 -vf \"fps=5,scale=320:-1:flags=lanczos\" -c:v pam -f image2pipe - | convert -delay 5 - -loop 0 -layers optimize test.gif" _, err := exec.command("bash", "-c", cmd).output() if err != nil { fmt.println(fmt.sprintf("failed to execute command: %s", err)) }
我收到此错误:
立即学习“go语言免费学习笔记(深入)”;
Failed to execute command: exec: "bash": executable file not found in $PATH
Alpine docker 镜像默认没有安装 bash。它使用 Ash shell 来代替
答案已经在这里 Docker:如何将 bash 与基于 Alpine 的 docker 镜像一起使用?
以上就是Docker golang + ffmpeg 执行命令失败的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号