singularityware / singularityware.github.io

base documentation site for Singularity software
https://singularityware.github.io
27 stars 49 forks source link

Run Sound App in Singularity #209

Closed bobhenkel closed 3 years ago

bobhenkel commented 3 years ago

Hello,

I come from a docker background and I'm just testing things out. Is there a way to launch a container with Singularity and allow it to produce sound. I have a container so far that can run Firefox, but sound doesn't come out if I have youtube playing. For example I believe on docker you can pass --device /dev/snd (Add a host device to the container). Here is my Singularity file

Bootstrap: docker
From: ubuntu:latest

%post
        apt-get update -y
        apt-get install -y firefox pulseaudio

%runscript
        firefox

Here are are the things I tried with no luck

./singularity-firefox.sif

And

singularity run --bind  /dev/snd:/dev/snd singularity-firefox.sif
FATAL:   could not open image /dev/snd:/dev/snd: failed to retrieve path for /dev/snd:/dev/snd: lstat /dev/snd:: no such file or directory

Thanks!

bobhenkel commented 3 years ago

Looks like there's a different github org to post issues too. Anyways I figured it out. This works, why I can't tell you as I have no idea.

singularity run --bind  /run singularity-firefox.sif