0

I reviewed this mediasoup v3 with Docker and have something slightly different in that I am getting a different error:

ERROR: for voice_server Cannot start service voice_server: Ports are not available: listen tcp 0.0.0.0:49163: bind: address already in use (the port changes per load)

I'm also losing audio output when running a containerized version of a server with mediasoup vs when I don't have it containerized. I tried to set network_mode to host as a way to avoid forwarding ports to no avail. Thank you! The docker compose file is as follows:

services:
  voice_server:
    build: ./voice
    environment: 
      - WEBRTC_LISTEN_IP=127.0.0.1
      - RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
    restart: unless-stopped
    ports:
      - 3000:3000
      - "40000-49999:40000-49999"

  backend:
    build: ./backend
    env_file: ./backend/.env
    restart: unless-stopped
    ports:
      - 4001:4001

  rabbitmq:
    image: rabbitmq:3-management-alpine
    container_name: rabbitmq
    volumes:
      - ./.docker/rabbitmq/data/:/var/lib/rabbitmq/
      - ./.docker/rabbitmq/logs/:/var/log/rabbitmq/
    environment:
      RABBITMQ_ERLANG_COOKIE: ${RABBITMQ_ERLANG_COOKIE}
    ports:
      - 5672:5672
      - 15672:15672

the dockerfile for the voice server is:

FROM node:12

WORKDIR /usr/src/app

COPY package.json package-lock.json ./

RUN npm i

COPY . .

RUN npm run build

ENV NODE_ENV production
CMD [ "node", "dist/index.js" ]
USER node

and the config for mediasoup is

export const config = {
  httpIp: "0.0.0.0",
  httpPort: 3000,
  httpPeerStale: 360000,

  mediasoup: {
    worker: {
      rtcMinPort: 40000,
      rtcMaxPort: 49999,
      logLevel: "debug",
      logTags: [
        "info",
        "ice",
        "dtls",
        "rtp",
        "srtp",
        "rtcp",
      ] as WorkerLogTag[],
    },
    router: {
      mediaCodecs: [
        {
          kind: "audio",
          mimeType: "audio/opus",
          clockRate: 48000,
          channels: 2,
        },
      ] as RtpCodecCapability[],
    },

    webRtcTransport: {
      listenIps: [
        {
          ip: process.env.WEBRTC_LISTEN_IP,
          announcedIp: undefined,
        },
        {
          ip: listenIp,
          announcedIp: undefined,
        },
      ] as TransportListenIp[],
      initialAvailableOutgoingBitrate: 800000,
    },
  },
} as const;
reactor
  • 1,722
  • 1
  • 14
  • 34
  • 1
    Can you try changing the value of `WEBRTC_LISTEN` to 0.0.0.0 (for example)? It might be part of the problem : when you refer to 127.0.0.1 in a container, you refer to this container, not your host. But it might be what you want. Can you try to use netstat and see which ports are in use ? – Faeeria Mar 21 '21 at 08:04
  • thanks! I just tried that and unfortunately, I'm still not getting audio. I also tried narrowing the range of ports just now – reactor Mar 21 '21 at 10:13

0 Answers0