Transport not producing when in Docker container

I’ve tried hosting my application using Docker, but the send transport doesn’t produce anything. I can connect and create transports, but not produce. All that is happening locally, not yet using a hosting service.

I’ve tried everything I could think of so far, I’ve set the:

  • ip: 0.0.0.0, announcedIp: container ip
  • ip: container ip, announcedIp: null,
  • ip: container ip, announcedIp: system ip,
  • ip: system ip, announcedIp: container ip,

Can anybody help me, would really appreciate it.

The first is what you want, but you also want to expose necessary ports, and make sure to expose UDP ports (Docker will expose TCP ports unless you add /udp).

I’ve also tried adding:

EXPOSE 8083 // my main application port

EXPOSE 3000-30100/udp

EXPOSE 3000-30100/tcp

But it still isn’t working

Here’s what I have in my Dockerfile

FROM ubuntu:20.04

# gcc g++ make
RUN \
    apt-get update && \
    apt-get install -y build-essential

# Python 3.8 and pip
RUN \
    DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && \
    apt install -y software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa && \
    apt update && \
    apt install -y python3.8 python3-pip

# NodeJS 14.X and npm
RUN \
    apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates && \
    curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
    apt-get install -y nodejs

WORKDIR /app

COPY package*.json ./

RUN npm i

COPY ./build .

EXPOSE 8083

EXPOSE 30000-30100/tcp

EXPOSE 30000-30100/udp

CMD [ "node", "index.js" ]

And my config file:

import os from "os";

const ifaces = os.networkInterfaces();

const getLocalIp = () => {
  let localIp = "127.0.0.1";

  Object.keys(ifaces).forEach((ifname) => {
    for (const iface of ifaces[ifname] ?? []) {
      // Ignore IPv6 and 127.0.0.1
      if (iface.family !== "IPv4" || iface.internal !== false) {
        continue;
      }

      // Set the local ip to the first IPv4 address found and exit the loop
      localIp = iface.address;
      return;
    }
  });

  return localIp;
};

const localIp = getLocalIp();

{
    // Worker settings
    numWorkers: Object.keys(os.cpus()).length,
    worker: {
      rtcMinPort: 30000,
      rtcMaxPort: 30100,
      logLevel: "warn",
      logTags: [
        "info",
        "ice",
        "dtls",
        "rtp",
        "srtp",
        "rtcp",
        // 'rtx',
        // 'bwe',
        // 'score',
        // 'simulcast',
        // 'svc'
      ],
    },
    // Router settings
    router: {
      mediaCodecs: [
        {
          kind: "audio",
          mimeType: "audio/opus",
          clockRate: 48000,
          channels: 2,
        },
        {
          kind: "video",
          mimeType: "video/VP8",
          clockRate: 90000,
          parameters: {
            "x-google-start-bitrate": 1000,
          },
        },
        {
          kind: "video",
          mimeType: "video/VP9",
          clockRate: 90000,
          parameters: {
            "profile-id": 2,
            "x-google-start-bitrate": 1000,
          },
        },
        {
          kind: "video",
          mimeType: "video/h264",
          clockRate: 90000,
          parameters: {
            "packetization-mode": 1,
            "profile-level-id": "4d0032",
            "level-asymmetry-allowed": 1,
            "x-google-start-bitrate": 1000,
          },
        },
        {
          kind: "video",
          mimeType: "video/h264",
          clockRate: 90000,
          parameters: {
            "packetization-mode": 1,
            "profile-level-id": "42e01f",
            "level-asymmetry-allowed": 1,
            "x-google-start-bitrate": 1000,
          },
        },
      ],
    },
    // WebRtcTransport settings
    webRtcTransport: {
      listenIps: [
        {
          ip: "0.0.0.0",
          announcedIp: localIp,
        },
      ],
      maxIncomingBitrate: 1500000,
      initialAvailableOutgoingBitrate: 1000000,
    },
  },

Ports need to be exposed on a container you’re running, those definitions in Dockerfile have no effect unless you use -P for docker run and even then AFAIK they are mapped to random ports.

I’ve tried that too, here’s what I tried

docker run -p 8083:8083 -p 30000-30100/udp -p 30000-30100/tcp -it helloworld

announcedIp should be IP that client can reach, not internal IP of the container. Just read the documentation around it carefully and specify correct value there.

Ok, thank you. Thanks for your time