0

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: "node:lts"
    volumes:
      - ../src:/home/node/app
    command: "node test.js"
    user: "node"
    working_dir: /home/node/app
    extra_hosts:
      - "host.docker.internal:host-gateway"

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.