Just a heads up before anyone spends hours upon hours troubleshooting this. The TL;DR - mediasoup under an alpine:latest (v3.16 at the time of this post) is problematic, save yourself the trouble an build your container using ubuntu/debian.
My application was working just fine and I decided to containerize it to make it a bit more portable. I built the docker container exactly how it should have been built, but I decided to use alpine:latest due to the incredibly small size of the containers (I use alpine for nearly everything including the mediasoup signaling).
However, I immediately started experiencing trouble which did not occur when I was not containerized. I assumed this was network related due to the symptoms, but I discovered after some troubleshooting that it was related entirely to the use of an alpine docker image.
Here are the symptoms -
mediasoup workers run per usual but odd stream issues will start surfacing after a very short while. Streams seem to no longer isolated from interfering with other streams, for example if a new consume attempts to consume from an existing producer that other consumers are listening to, those other consumers will temporarily lose their streams which will eventually start up again. Closing a consumer/transport will also cause other consumers to experience a temporary loss until the stream recovers.
Simply shifting your docker container over to ubuntu:latest (at the time of this post that is 22.04) allows mediasoup to work flawlessly. I haven’t tested with any other images, but I assume any full traditional container w/ GNU libc would probably work and containers which use musl libc may be problematic.
If you have insight as to why mediasoup has issues with alpine / alpine:latest under docker (possibly outside of docker too?), feel free to share.