Closed dosentmatter closed 3 years ago
Thank you for the Dockerfile. I successfully generate wave file with following command:
docker run -it -v /Users/hgneng/code/docker/:/mnt/docker dosentmatter/ekho 123 -o /mnt/docker/demo.wav
Can we play it directly from docker? When I try to play it directly, it seems pulseaudio not working.
$ docker run -it dosentmatter/ekho 123
pa_simple_new() failed: Connection refused
pa_sample_spec(format=3,rate=16000,channels=ch=1)
Fail to init audio stream.
Fail to init sound.
You're welcome. Yeah, you can play it directly from docker. What operating system are you using? I wrote instructions for Linux, macOS, Windows (Powershell or WSL) in the Dockerfile.
You have to route the audio to the host to be able to hear any sound since docker doesn't support audio by itself.
For Linux, in order to route the audio, you have to add the host's sound device to the running container.
For macOS and Windows, you have to have a pulseaudio server running on the host OS. Then set the pulseaudio client in the container to point to the pulseaudio server.
Copy-pasted (with some modifications) from the Dockerfile:
# Linux:
docker run --rm -it \
--device /dev/snd \
dosentmatter/ekho -s -30 -v Toisanese 排骨
# macOS:
brew install pulseaudio
# Using BSD `sed` to enable network pulseaudio through tcp
sed -i '' \
-e '/#load-module module-native-protocol-tcp/ s/^#//' \
/usr/local/Cellar/pulseaudio/*/etc/pulse/default.pa
brew services start pulseaudio
# mount .config/pulse/cookie for authentication to the server.
docker run --rm -it \
-e PULSE_SERVER=host.docker.internal \
--mount type=bind,source=$HOME/.config/pulse,target=/home/pulseaudio/.config/pulse \
dosentmatter/ekho -s -30 -v Toisanese 排骨
I am using MacOS. I see. I need to route audio to the host.
Thank you very much! You teach me a lot!
Hey @hgneng, this is the Dockerfile mentioned in #37. I'm not sure if you want to have instructions in a README somewhere, but I put instructions inside the Dockerfile.
To build the docker image, you do
docker build --pull -t dosentmatter/ekho .
.Currently, I pushed it to my own dockerhub repo, but that can change. If you push it to your own repo, you could set up automatic builds from this github repo.
I also have it hardcoded to
curl
and built from ekho version8.5
, because I only know how to build from the release and not the github repo.This docker image might be useful for users that don't want to bother with building
ekho
manually. They can just pull the docker image and run it.