I am running OpenAI Whisper (speech to text) on Docker on my headless server using the default command:
docker run -it -v ${PWD}/models:/root/.cache/whisper -v ${PWD}/audio-files:/app openai-whisper whisper audio-file.mp3 --model turbo --language Italian --output_dir /app --output_format txt
The process runs fine and I can track the progress of the audio transcription via the console. My issue is that I cannot get the output text file.
The docker container automatically exits at the end of the process but the file is inside and I would like it to have it copied on my machine (outside the container) before it exits. Is there a way to do so?
If not, how can I access the output file within the exited container? If I do
docker start <container>
it exits straight away.
Formalizing my comment as an answer:
Let's examine the arguments passed to the docker run
command. -v
is short for --volume
, and is used to mount a local directory to the container. Here, -v ${PWD}/audio-files:/app
means that the local ${PWD}/audio-files
directory will be mounted to /app
in the container.
Now, if we look at the arguments passed to openai-whisper
, we can see --output_dir /app
, meaning the output should be written to /app
. Since this directory is in fact a mounted volume, and file created there should be accessible from the local ${PWD}/audio-files
directory, even after the container exists.