geckos.io: Datachannel connection failing when server running in docker

I tried out running my app in docker, and while the signaling server works fine (a log from the authorization method is printed), the data channel seems to never open (log in onConnection never printed).

I’ve been careful to only use one port and publish it in docker

Port configuration My Dockerfile:
FROM node:16-slim AS build
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN yarn
RUN yarn build

FROM gcr.io/distroless/nodejs:16
COPY --from=build /usr/src/app/dist/index.js /usr/src/app/index.mjs
COPY --from=build /usr/src/app/node_modules /usr/src/app/node_modules
WORKDIR /usr/src/app
CMD ["index.mjs"]
EXPOSE 6969
EXPOSE 9696/udp

My geckos port range:

  portRange: { min: 9696, max: 9696 },

My command to start the container: docker run --rm -p 6969:6969 -p 9696:9696/udp arthuro5555/thnk-relay

Running it with node directly works. I am guessing this must be a misunderstanding/misconfiguration on my side, but I report this as a bug just in case.

I am getting this issue both on my windows machine with docker desktop as on my linux server (running through k3s)

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 35 (24 by maintainers)

Most upvoted comments

Note re “using network host mode” to resolve this (i.e: running with docker run -d --net=host) this mode only works on linux and not Mac/Win.

Kubernetes host netwrok mode might be worth trying - I think that works on all platforms unlike the docker one.

Update, after updating Docker for Mac on my M1 from 4.1 to 4.16 it is now not working on any platform. Points for consistency, I guess?

  • ❗ Docker for Mac - Macbook Air M1 Apple Silicon
  • ❗ Docker for Mac - Macbook Pro Intel (2015)
  • ❗ Windows / WSL - Windows 11

Before (working)

image 2023-01-28 at 1 29 23 pm

After (not working anymore)

image 2023-01-28 at 1 43 56 pm

Have you checked out Stunner ecosystem for deploying WebRTC apps with k8s?

Edit: This is not 100% relevant to the above issue, just thought it was worth flagging.

I’m using Windows and WSL, maybe if we deploy it, it will work?