docker-steam-headless icon indicating copy to clipboard operation
docker-steam-headless copied to clipboard

[Bug]: Sunshine ports are not exposed

Open ohare93 opened this issue 1 year ago • 7 comments

Describe the Bug

The docker container installs Sunshine, but does not expose the ports in the dockerfile. Nor are the ports connected opened in the Unraid template.

How is one supposed to connect to Sunshine via Moonlight when the ports are not opened?

Steps to Reproduce

  1. Try connect to Sunshine in Docker container
  2. Cannot

Expected Behavior

Can connect

Screenshots

Sunshine docker image: https://hub.docker.com/r/lizardbyte/sunshine image

Relevant Settings

Dockerfile only has EXPOSE 8305 https://github.com/Steam-Headless/docker-steam-headless/blob/master/Dockerfile.debian#L556 More should be exposed for Sunshine specifically

Version

latest

Platform

Unraid. The rest is irrelevant for this issue.

Relevant log output

None.

ohare93 avatar Aug 09 '24 12:08 ohare93

Sunshine is the main reason the container needs to be run using host networking. The template on unRAID should reflect that. When using the host network you do not need to expose ports in order to make them available.

alansari avatar Aug 09 '24 14:08 alansari

You don't need to expose ports to make them available through Docker while on host mode? Well that is news to me.

Still I could not connect. Nothing would work. But your reply here gave me the idea to just go add the ports into the Unraid template:

image

And it worked! I can now connect

image

No keyboard or mouse controls, that is surely a small issue. I can actually find the machine now.


So am I understanding right that it is the intention that none of the ports are explicitly opened in either the Dockerfile or Unraid template, and that this setup apparently works for other people? 🤔

ohare93 avatar Aug 09 '24 21:08 ohare93

"No keyboard or mouse controls, that is surely a small issue. I can actually find the machine now." <-- not a small issue and the root reason for the host networking requirement. The fact that you had to add the ports to the template leads me to believe you are not using host networking. Maybe attempting to run behind a proxy/reverse proxy, or using a custom ip on a bridged network?

Correct in that people are using host networking, not setting any ports in the template, have sunshine connecting, and inputs work correctly. Using ipvlan or macvlan, as i'm guessing you might be, would require the ports being opened for moonlight/sunshine just to connect. But due to the way sunshine handles inputs you still need to use host networking for inputs to function, current options are bind monuting the host udev data and input dev, or use dumb-udev (which is the default and recommended method) that is built into the container. If you need any additional help jump on discord for faster response times. You can refrence docker host networking here: https://docs.docker.com/network/drivers/host/

alansari avatar Aug 10 '24 05:08 alansari

"No keyboard or mouse controls, that is surely a small issue. I can actually find the machine now." <-- not a small issue and the root reason for the host networking requirement.

Interesting.

The fact that you had to add the ports to the template leads me to believe you are not using host networking.

image

Never have been, yet I also cannot get access

Maybe attempting to run behind a proxy/reverse proxy, or using a custom ip on a bridged network?

Nope, none of that. I do have a reverse proxy setup on my server (Traefik) with some self hosted services, but I haven't gotten around to this container yet. Though that would be an end goal, to be able to connect to Steam/Sunshine while away from home and without just connecting to my home vpn. Due to other constraints I can no longer use the Steam streaming method.

"Bridged network" though, I am not 100% on the definitions here. Here is my home internet setup:

  1. The Router is plugged into the wall with its wifi disabled
  2. Network Switch is plugged into the router
  3. A UniFi Cloud Key is plugged into the switch a) which spreads its own wifi to 2 extention boxes across the house, that are also plugged into the switch
  4. Unraid server is plugged directly into the router.

I wonder if I must have it plugged into the switch 🤔 Probably!

ohare93 avatar Aug 13 '24 07:08 ohare93

I was having a similar issue with the input not working despite being seemingly setup with network type "host". My issue turned out to be as simple as "host" needing to be in quotes in the docker-compose.yml file:

    # NETWORK:
    ## NOTE:  With this configuration, if we do not use the host network, then physical device input
    ##        is not possible and your USB connected controllers will not work in steam games.
    network_mode: "host" # <-- this is now in quotes
    hostname: ${NAME}
    extra_hosts:
      - "${NAME}:127.0.0.1"

The example file did not have quotes around host. After this change, I no longer needed to manually open the Sunshine ports and input worked as expected.

stealthdave avatar Nov 30 '24 20:11 stealthdave

Is it safer to explicitly expose the ports needed by sunshine than running the host network mode?

aifreedom avatar Sep 27 '25 06:09 aifreedom

Is it safer to explicitly expose the ports needed by sunshine than running the host network mode?

Yea, but host network is required for uinput and controllers to work. Nothing to do with the services running in the container. If you switch to another network mode, sunshine will not be able to create and use virtual controllers inside this container.

Josh5 avatar Sep 27 '25 07:09 Josh5