Possibly simpler invocation #62

Closed
opened 2025-12-28 23:22:52 +01:00 by adam · 6 comments
Owner

Originally created by @jimdigriz on GitHub (Jul 24, 2020).

I find the following helps get audio (pulseaudio seems to be what everyone has by default) and works around various gotchas regarding permissions (assumes you are a member of the kvm group already so can access /dev/kvm without making it globally read-write):

docker run \
  --privileged \
  -e "DISPLAY=${DISPLAY:-:0.0}" \
  -e EXTRA='-audiodev pa,id=hda-duplex,server=unix:/tmp/pulseaudio-socket' \
  -v /dev/kvm:/dev/kvm \
  -v /tmp/.X11-unix:/tmp/.X11-unix \
  -v /run/user/$(id -u)/pulse/native:/tmp/pulseaudio-socket \
  sickcodes/docker-osx
Originally created by @jimdigriz on GitHub (Jul 24, 2020). I find the following helps get audio (pulseaudio seems to be what everyone has by default) and works around various gotchas regarding permissions (assumes you are a member of the `kvm` group already so can access /dev/kvm without making it globally read-write): ``` docker run \ --privileged \ -e "DISPLAY=${DISPLAY:-:0.0}" \ -e EXTRA='-audiodev pa,id=hda-duplex,server=unix:/tmp/pulseaudio-socket' \ -v /dev/kvm:/dev/kvm \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /run/user/$(id -u)/pulse/native:/tmp/pulseaudio-socket \ sickcodes/docker-osx ```
adam added the enhancementdocumentation labels 2025-12-28 23:22:52 +01:00
adam closed this issue 2025-12-28 23:22:52 +01:00
Author
Owner

@sickcodes commented on GitHub (Jul 25, 2020):

This looks good, I will add this to the troubleshooting section, thank you!!

Only issue is it wouldn't work for anyone who isn't using pulse audio.

@sickcodes commented on GitHub (Jul 25, 2020): This looks good, I will add this to the troubleshooting section, thank you!! Only issue is it wouldn't work for anyone who isn't using pulse audio.
Author
Owner

@jimdigriz commented on GitHub (Jul 25, 2020):

Drop the audio bits for now, though it plumbs on on my side and pulseaudio sees QEMU, I'm not hearing any sound so I should dig further into it. Though you do get a 95% solution by just simply documenting it so that would be great too.

As a passing note, you could make the flip between pulseaudio and alsa automatic, two options either use test -c from shell against where you expect the ALSA device to be or (as image size is not a problem) then drag in an ALSA CLI tool to do the testing for you.

@jimdigriz commented on GitHub (Jul 25, 2020): Drop the audio bits for now, though it plumbs on on my side and pulseaudio sees QEMU, I'm not hearing any sound so I should dig further into it. Though you do get a 95% solution by just simply documenting it so that would be great too. As a passing note, you could make the flip between pulseaudio and alsa automatic, two options either use `test -c` from shell against where you expect the ALSA device to be or (as image size is not a problem) then drag in an ALSA CLI tool to do the testing for you.
Author
Owner

@sickcodes commented on GitHub (Jul 28, 2020):

Would you like to submit a PR for the readme edit?
I would put it under the extended run in the troubleshooting section :)

@sickcodes commented on GitHub (Jul 28, 2020): Would you like to submit a PR for the readme edit? I would put it under the extended run in the troubleshooting section :)
Author
Owner

@jimdigriz commented on GitHub (Jul 29, 2020):

Sure, happy to help out! I'll have a bit more of a stab with getting both pulse and alsa working and then get back to you.

@jimdigriz commented on GitHub (Jul 29, 2020): Sure, happy to help out! I'll have a bit more of a stab with getting both pulse and alsa working and then get back to you.
Author
Owner

@mrkvn commented on GitHub (Jan 9, 2021):

I ran this command and it outputs a list of Modules/Sinks. Not sure what to do with them.

docker run \
    --device /dev/kvm \
    -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \
    -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e PULSE_SERVER=unix:/tmp/pulseaudio.socket \
    sickcodes/docker-osx pactl list

And created the container by running this.

docker run \
    --device /dev/kvm \
    -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \
    -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    sickcodes/docker-osx

I actually didn't use the image sickcodes/docker-osx. I modified the size in Dockerfile from 200G to 80G to create a new image. OSX is installed and booted properly there's just no output sound device. Not sure what I did wrong. Thanks.

@mrkvn commented on GitHub (Jan 9, 2021): I ran this command and it outputs a list of Modules/Sinks. Not sure what to do with them. ``` docker run \ --device /dev/kvm \ -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \ -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e PULSE_SERVER=unix:/tmp/pulseaudio.socket \ sickcodes/docker-osx pactl list ``` And created the container by running this. ``` docker run \ --device /dev/kvm \ -e AUDIO_DRIVER=pa,server=unix:/tmp/pulseaudio.socket \ -v "/run/user/$(id -u)/pulse/native:/tmp/pulseaudio.socket" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ sickcodes/docker-osx ``` I actually didn't use the image sickcodes/docker-osx. I modified the size in Dockerfile from 200G to 80G to create a new image. OSX is installed and booted properly there's just no output sound device. Not sure what I did wrong. Thanks.
Author
Owner

@jimdigriz commented on GitHub (Jan 9, 2021):

I actually didn't use the image sickcodes/docker-osx. I modified the size in Dockerfile from 200G to 80G to create a new image. OSX is installed and booted properly there's just no output sound device. Not sure what I did wrong. Thanks.

As per the notes in the PR https://github.com/sickcodes/Docker-OSX/pull/82 which adds to the troubleshooting section of the README:

PulseAudio for sound (note neither AppleALC and varying alcid or VoodooHDA-OC have codec support though IORegistryExplorer does show the controller component working)

It means (though probably could be clearer/explicit) that the pulseaudio plumbing is now there (so audio from the guest to the host will work) but OS X has no 'codec' component (though it does have a 'driver') to actually drive sound through it...there is no audio support.

If someone can figure out the codec problem, that would solve this. Good luck!

@jimdigriz commented on GitHub (Jan 9, 2021): > I actually didn't use the image sickcodes/docker-osx. I modified the size in Dockerfile from 200G to 80G to create a new image. OSX is installed and booted properly there's just no output sound device. Not sure what I did wrong. Thanks. As per the notes in the PR https://github.com/sickcodes/Docker-OSX/pull/82 which adds to the [troubleshooting section of the README](https://github.com/sickcodes/Docker-OSX/blob/master/README.md#troubleshooting): > PulseAudio for sound (note neither AppleALC and varying alcid or VoodooHDA-OC have codec support though IORegistryExplorer does show the controller component working) It means (though probably could be clearer/explicit) that the pulseaudio plumbing is now there (so audio from the guest to the host will work) but OS X has no '*codec*' component (though it does have a 'driver') to actually drive sound through it...there is no audio support. If someone can figure out the codec problem, that would solve this. Good luck!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#62