docker内启动程序播放声音是报错:
sh: 1: aplay: not found
解决办法
- 安装alsa-utils
- 在启动容器时加上硬件访问参数
apt-get update
apt-get install alsa-utils
List the sound cards
aplay -l
# aplay: device_list:268: no soundcards found...
And playing this sound will fail because this image doesn't have any sound cards
sudo aplay /usr/share/sounds/alsa/Front_Center.wav
docker run -ti --rm \
-v /dev/snd:/dev/snd \
--privileged \
myContainer sh -c "echo run something"`