<p><strong><a href="https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio" rel="nofollow noreferrer">This page describes three possible ways how to set up sound for docker containers without x11docker. Most common is the easy ALSA setup. A bit more advanced, but with better integration in most desktop environments is a setup with Pulseaudio.</a></strong></p>
<p>TLDR
Share the host’s sound devices:</p>
<pre><code>docker run --rm --device /dev/snd --group-add audio your_image_name
</code></pre>

CC BY-SA 4.0
2024-11-11T15:57:19.753Z
I did see this page. The most easy setup would probably be ideal and sufficient for my needs, but I'm confused a bit on where I'd be running this. It says that x11docker provides this setup with --alsa, but I'm guessing that's just informative and what follows is for still doing it without x11docker?
muttley91
CC BY-SA 4.0
2024-11-10T23:14:49.380Z
2024-11-10T23:14:49.380Z
YassineLbk
<p>I'm trying to run the latest version of Stardew Valley in a Docker container to run it as a server setup (for the record, I own the game and am using my own purchased copy to do this, per <a href="https://github.com/norimicry/stardew-multiplayer-docker" rel="nofollow noreferrer">this repository's instructions</a>).</p>
<p>When I try to run it, I get the following error:</p>
<pre><code>Game.Initialize() caught exception initializing XACT.
Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL device could not be initialized, see console output for details.
   at Microsoft.Xna.Framework.Audio.OpenALSoundController..ctor() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Platform\Audio\OpenALSoundController.cs:line 117
   at Microsoft.Xna.Framework.Audio.OpenALSoundController.EnsureInitialized() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Platform\Audio\OpenALSoundController.cs:line 300
   at Microsoft.Xna.Framework.Audio.SoundEffect.Initialize() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\SoundEffect.cs:line 196
   at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(MiniFormatTag codec, Byte[] buffer, Int32 channels, Int32 sampleRate, Int32 blockAlignment, Int32 loopStart, Int32 loopLength) in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\SoundEffect.cs:line 153
   at Microsoft.Xna.Framework.Audio.WaveBank..ctor(AudioEngine audioEngine, String waveBankFilename, Boolean streaming, Int32 offset, Int32 packetsize) in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\Xact\WaveBank.cs:line 276
   at StardewValley.Game1.Initialize() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\Farmer\Farmer\Game1.cs:line 2229
</code></pre>
<p>I'm thinking this tells me that I need a sound device, which obviously my Docker container doesn't have. Is it possible to mimic a sound device in a Docker container just enough to satiate the requirement here?</p>

<docker>
Simulate an Audio Device in a Docker Container
muttley91
# Simulate an Audio Device in a Docker Container

(Asked by: username_0 on 2024-11-05)

I'm trying to run the latest version of Stardew Valley in a Docker container to run it as a server setup (for the record, I own the game and am using my own purchased copy to do this, per this repository's instructions).
When I try to run it, I get the following error:
Game.Initialize() caught exception initializing XACT.
Microsoft.Xna.Framework.Audio.NoAudioHardwareException (0x80004005): OpenAL device could not be initialized, see console output for details.
   at Microsoft.Xna.Framework.Audio.OpenALSoundController..ctor() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Platform\Audio\OpenALSoundController.cs:line 117
   at Microsoft.Xna.Framework.Audio.OpenALSoundController.EnsureInitialized() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Platform\Audio\OpenALSoundController.cs:line 300
   at Microsoft.Xna.Framework.Audio.SoundEffect.Initialize() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\SoundEffect.cs:line 196
   at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(MiniFormatTag codec, Byte[] buffer, Int32 channels, Int32 sampleRate, Int32 blockAlignment, Int32 loopStart, Int32 loopLength) in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\SoundEffect.cs:line 153
   at Microsoft.Xna.Framework.Audio.WaveBank..ctor(AudioEngine audioEngine, String waveBankFilename, Boolean streaming, Int32 offset, Int32 packetsize) in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\MonoGame.Desktop\MonoGame.Framework\Audio\Xact\WaveBank.cs:line 276
   at StardewValley.Game1.Initialize() in D:\GitlabRunner\builds\Gq5qA5P4\1\ConcernedApe\stardewvalley\Farmer\Farmer\Game1.cs:line 2229

I'm thinking this tells me that I need a sound device, which obviously my Docker container doesn't have. Is it possible to mimic a sound device in a Docker container just enough to satiate the requirement here?

**Tags:** docker


---

## 1 answers

### Answer by username_1 on 2024-11-10. Score: 0

This page describes three possible ways how to set up sound for docker containers without x11docker. Most common is the easy ALSA setup. A bit more advanced, but with better integration in most desktop environments is a setup with Pulseaudio.
TLDR
Share the host’s sound devices:
docker run --rm --device /dev/snd --group-add audio your_image_name

> **Comments:**
> **username_0**: I did see this page. The most easy setup would probably be ideal and sufficient for my needs, but I'm confused a bit on where I'd be running this. It says that x11docker provides this setup with --alsa, but I'm guessing that's just informative and what follows is for still doing it without x11docker?  

---

