The Problem:
Trying to record audio on Arm container with a X86 Host using python and PyAudio
In depth:
Hi, ive been trying to record audio in a docker container
I’m running Ubuntu 20.04 X86 as my main os
and I’ve built a Dockerfile to create an environment
when I’m building from an X86 image, recording works just fine
when building an Arm image, the script fails to connect to audio device
with the following statement
“OSError: [Errno -9996] Invalid input device (no default output device)”
using lsusb - both containers see all of the devices.
I couldn’t find any source to solve my problem.
Env:
I’ve used these commands to create Arm Containers on X86:
sudo apt-get install qemu binfmt-support qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -t arm64v8/ubuntu uname -m
on docker run - both containers run with --privileged
The arm container works great, running uname -m on it confirms that its arm based
any ideas? maybe defining somehow a default device?
DockerFile
# when using arm
FROM arm64v8/ubuntu
# when using ubuntu
# FROM ubuntu
COPY req.txt /req.txt
# installing
# when using arm
RUN dpkg --add-architecture armhf
RUN apt update -y && apt upgrade -y
# isntalling python
RUN apt install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa -y && apt update -y
RUN apt install python3.8 -y && apt install python3-pip -y
# RUN ln -s /usr/bin/python3.8 /usr/bin/python3
# installing requierments
RUN apt-get install libasound-dev -y && apt-get install portaudio19-dev -y \
&& pip install pyaudio --user && apt-get install python3-pyaudio
RUN apt-get install pkg-config -y && apt-get install libcairo2-dev -y
RUN pip install -r /req.txt
RUN apt install git -y
RUN apt-get install -y pulseaudio && apt install -y alsa