Docker container can't reach host services I am running a nodejs app in a docker (v 20.10.2) container on a Ubuntu 20.04 LTS (this is for dev purpose only)
My docker-compose config
  test:
    container_name: forge_test
    restart: always
    image: &quot;node:lts&quot;
    volumes:
      - ../src:/home/node/app
    command: &quot;node test.js&quot;
    user: &quot;node&quot;
    working_dir: /home/node/app
    extra_hosts:
      - &quot;host.docker.internal:host-gateway&quot;

In the docker, I can ping host.docker.internal (which does not work without extra_hosts), however I can not reach any services that I have running on any port (the port I am actually trying to reach is 7545 but none work) on the host.
Searching for a few hours now, no solutions I have found (adding docker0 to iptable, adding docker.host.internal to /etc/hosts) work.
Am I missing something? Could there be a firewall blocking access somewhere (II have ufw installed but tbh I don't really know how to use it)?
I can't find any similar issue where host.docker.internal can be pinged but the posrts not accessed
It happens that the problem comes from ufw not allowing connections from docker containers on host ports.
Deactivating it helped for now, since it's only for dev purpose.