Docker golang + ffmpeg fails to execute command

王林
Release: 2024-02-06 11:45:13
forward
1088 people have browsed it

Docker golang + ffmpeg 执行命令失败

Question content

Hello, I am using the following docker image:

from golang:alpine3.18
Copy after login

Using ffmpeg: (Maybe I'm missing something here)

run apk add --no-cache ffmpeg
Copy after login

But when trying to do the following:

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))
}
Copy after login

I get this error:

Failed to execute command: exec: "bash": executable file not found in $PATH
Copy after login

Correct answer


The Alpine docker image does not have bash installed by default. It uses Ash shell instead

The answer is already here Docker: How to use bash with Alpine based docker image?

The above is the detailed content of Docker golang + ffmpeg fails to execute command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!