3

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
...
rostamiani
  • 2,859
  • 7
  • 38
  • 74

2 Answers2

6

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.

rostamiani
  • 2,859
  • 7
  • 38
  • 74
  • while i using ec2 instance i need to use public ip of the ec2 instance which resolves the problem for ubuntu lts but for macos i need to use host.docker.internal inside the docker to access local db – Tanjin Alam Apr 07 '23 at 12:07
  • I hope you win something! Thank you! – Lizozom Jun 05 '23 at 15:35
2

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
Ken Aqshal
  • 23
  • 6