Mediasoup error when running ObserveRTC example: `getaddrinfo ENOTFOUND host.docker.internal`

7.6k views Asked by At

This is the project I want to setup: https://github.com/ObserveRTC/full-stack-examples

I started the app using this command:

SFU_ANNOUNCED_IP="192.168.60.79" docker-compose up

And this error happened at MediaSoup:

ObserveRTC::RestTransport Wed, 14 Dec 2022 07:44:56 GMT Request failed. canRetry: true Error: getaddrinfo ENOTFOUND host.docker.internal
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'host.docker.internal'
}

I found this IP from ifconfig:

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.60.79  netmask 255.255.255.0  broadcast 192.168.60.255
...
2

There are 2 answers

2
rostamiani On BEST ANSWER

host.docker.internal parameter in Docker Compose file only defined in Windows and Mac which resolves to the internal IP address used by the host

But my OS was Linux!

In linux Use localhost in host mode or 172.18.0.1 for bridge mode.

0
Ken Aqshal On

I encounter same issue in my project, and fix this issue by adding extra host configuration in docker compose

service:
   container_name: myService
   extra_hosts:
     - "host.docker.internal:host-gateway" <---- add this part

My environment:

  • Ubuntu 22.04
  • Docker 24.0.2