I'm trying to emulate microphone input for a headless chrome instance, inside a docker container.
Based on Emulating microphone input to Chrome inside Docker container I have the following setup:
Dockerfile
FROM buildkite/puppeteer:latest
RUN apt-get -qq update && apt-get install -y pulseaudio
COPY entrypoint.sh /opt/bin/entrypoint.sh
RUN useradd -ms /bin/bash bot
USER bot
ENTRYPOINT /opt/bin/entrypoint.sh
entrypoint.sh
# Load pulseaudio virtual audio source
pulseaudio -D --verbose --exit-idle-time=-1
# Create virtual output device (used for audio playback)
pactl load-module module-null-sink sink_name=DummyOutput sink_properties=device.description="Virtual_Dummy_Output"
# Create virtual microphone output, used to play media into the "microphone"
pactl load-module module-null-sink sink_name=MicOutput sink_properties=device.description="Virtual_Microphone_Output"
# Set the default source device (for future sources) to use the monitor of the virtual microphone output
pacmd set-default-source MicOutput.monitor
# Create a virtual audio source linked up to the virtual microphone output
pacmd load-module module-virtual-source source_name=VirtualMic
# Allow pulse audio to be accssed via TCP (from localhost only), to allow other users to access the virtual devices
pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
mkdir -p /home/bot/.pulse
echo "default-server = 127.0.0.1" > /home/bot/.pulse/client.conf
chown bot:bot /home/bot/.pulse -R
When running the container, pulseaudio -D --verbose --exit-idle-time=-1
fails with no further details though:
E: [pulseaudio] main.c: Daemon startup failed.
I can rule out that pulseaudio autostarts inside the container, since the subsequent output is as follows:
Connection failure: Connection refused
Connection failure: Connection refused
No PulseAudio daemon running, or not running as session daemon.
No PulseAudio daemon running, or not running as session daemon.
No PulseAudio daemon running, or not running as session daemon.
and trying pulseaudio -k
results in E: [pulseaudio] main.c: Failed to kill daemon: No such process
The lack of errors makes it pretty difficult for me to figure out what's wrong, especially because I do not have any experience with pulseaudio whatsoever. Does anyone have an idea what may be wrong or why pulseaudio won't start or give any errors?
Currently testing on a Ubuntu 16.04 Desktop. It should be able to run on a server though.