Hello, I am using the following docker image:
from golang:alpine3.18
Using ffmpeg: (Maybe I'm missing something here)
run apk add --no-cache ffmpeg
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)) }
I get this error:
Failed to execute command: exec: "bash": executable file not found in $PATH
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!