'How to pass custom parameters when creating docker swarm service?

I am new to docker and docker swarm and started dockerizing several services and am trying to get them running as docker swarm services. I ran into a road block with the linuxserver/ffmpeg image:

  1. it uses a --device parameter which is not implemented in create service
  2. it expects several custom parameters to pass them to the ffmpeg encoder

From my research up to now I assume that passing parameters is not implemented in docker create service, but maybe you can think of a workaround? (unfortunately the image does not process environment variables, or at least they are not documented)

This is how I start dockerized ffmpeg (working fine in standalone mode):

docker run -d /
--network="host" /
--device=/dev/video0:/dev/video0 / ### error: unknow flag
--name ffmpeg_streamer /
--restart always -it /
-v $(pwd)/video:/video /
linuxserver/ffmpeg / ### custom parameters below here
-stream_loop /
-1 -re -nostdin /
-i "/video/test.avi" /
-f pulse /
-vcodec libx264 /
-preset:v veryfast /
-b:v 400k /
-f flv rtmp://localhost:1935/live/streamkey

Many thanks for looking into this!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source