如何将 ffmpeg 命令安装到我的 docker
How to Install ffmpeg command into my docker
我正在 docker-compose.yml:
app:
image: golang:1.14.3
ports:
- "8080:8080" ## Share API port with host machine.
depends_on:
- broker
- ffmpeg
volumes:
- .:/go/src/go-intelligent-monitoring-system
- /home/:/home/
working_dir: /go/src/go-intelligent-monitoring-system
command: apt-get install ffmpeg ########-------<<<<<<---------#################
command: go run main.go
但是当我在我的代码中使用它时,出现了这个错误:
--> ""exec: "ffmpeg": 在 $PATH 中找不到可执行文件""
只有 compose 文件中的最后一个 command
才会生效,因此您没有机会使用当前的 compose 文件安装 ffmpeg。
作为替换,您应该像接下来一样在自定义的 dockerfile 中安装 ffmpeg
,参考 this:
app:
build: ./dir
把你自定义的 Dockerfile
放在上面 dir
像下面这样:
Dockerfile:
FROM golang:1.14.3
RUN apt-get update && apt-get install ffmpeg -y
我正在 docker-compose.yml:
app:
image: golang:1.14.3
ports:
- "8080:8080" ## Share API port with host machine.
depends_on:
- broker
- ffmpeg
volumes:
- .:/go/src/go-intelligent-monitoring-system
- /home/:/home/
working_dir: /go/src/go-intelligent-monitoring-system
command: apt-get install ffmpeg ########-------<<<<<<---------#################
command: go run main.go
但是当我在我的代码中使用它时,出现了这个错误: --> ""exec: "ffmpeg": 在 $PATH 中找不到可执行文件""
只有 compose 文件中的最后一个 command
才会生效,因此您没有机会使用当前的 compose 文件安装 ffmpeg。
作为替换,您应该像接下来一样在自定义的 dockerfile 中安装 ffmpeg
,参考 this:
app:
build: ./dir
把你自定义的 Dockerfile
放在上面 dir
像下面这样:
Dockerfile:
FROM golang:1.14.3
RUN apt-get update && apt-get install ffmpeg -y