Docker setup with listenIps

Hi All,

I’m having some issue receiving AV whilst producing. This is failing due to the fact I’m not passing correct listening ip.

My nodejs server is in a docker container running on my local machine. I have passed in the docker container 172.18.x.x address, have also tried my private ipaddress, though they connects but unable to produce. It keeps failing in the producerTransport event.

By the way, i’m using the documentation @ibc :slight_smile: and have made quite a lot of progress already. The sample also provide a good understanding.

Attached here’s my docker-compose.yml

version: "3"

services:
  # Nginx web server acting as a reverse proxy for "web" and "api" services
  nginx:
    image: nginx
    read_only: false
    depends_on:
      - api
    ports:
      - "8080:80"
      - "8443:443"
  # Data API and authentication/authorization
  api:
    image: node:12.18.3
    hostname: api
    depends_on:
      - db
      - redis
    links:
      - db
      - redis
    environment:
      - DEBUG=*live-server*
      - NODE_DEBUG=true
      - NODE_ENV=development
      - REDIS_URL_SUBS=redis://redis:6379/4
      - ENABLE_DB_DEBUG=true
    expose:
      - "8080"
      - "3000"
      - "5000"
    ports:
      - "127.0.0.1:9229:9229" # V8 inspector (when NODE_DEBUG=true)
      - "127.0.0.1:57777:57777"
    user: node
    working_dir: /usr/src/app
    command: node tools/run.js
  redis:
    image: redis:3.2.8-alpine
    read_only: true
    volumes:
      - redis:/data
    user: redis
volumes:
  redis:
  yarn:

And my webRtcTransportOptions config…

webRtcTransportOptions: {
      listenIps: [
        {
          ip: "192.168.x.x", // private ip
          announcedIp: null,
        },
      ],
      enableUdp: true,
      enableTcp: true,
      preferUdp: true,
      initialAvailableOutgoingBitrate: 1000000,
      minimumAvailableOutgoingBitrate: 600000,
      maxSctpMessageSize: 262144,
      maxIncomingBitrate: 1500000,
    },

Would appreciate any help.

ip: use docker 172.18.x.x
announcedIp: use public instance id

1 Like

and you need to define ports range needed for mediasoup in docker.
check this example: GitHub - ysf465639310/CLOUD_MEDIASOUP: It's a demo application of mediasoup v3, base on docker engine

Thanks @pixiil I was able to connect that way. You saved me 2 days

I’ve now deployed my docker to my AWS EC2 environment under nginx. I’m a little clueless how to get things working.

What have tried so far:

I’m passing the AWS EC2 public IP as the announceIp and the private Ip of the docker container as the listenIp.

This is not working so far. Any idea what else I could try?

I’m running mediasoup on AWS ECS and my config looks like:

{ ip: "0.0.0.0", announcedIp: publicIp }

You’ll also need to configure your AWS Security Group to allow TCP/UDP on whatever port range you’re using.

Thanks will give that a shot and revert.

Hi i try to use { ip: "0.0.0.0", announcedIp: publicEC2Ip } and { ip: "172.17.0.2", announcedIp: publicEC2Ip }
On Security Group allow All TCP/UDP

And still not working, returns black screen an then all ICE get closed
Any idea what else I could do?

Did you forward your ports from a container to the host network though (or run container with host network)?