seelio / node-inspector-docker

An example of using node-inspector with docker
22 stars 1 forks source link

Can't access the inspector #1

Open iazel opened 8 years ago

iazel commented 8 years ago

Hello, I'm quite new to docker and this repo has been very useful to me, but as of today it's outdated. I'm using docker 1.11.2 and can't run the example because of the many errors in the docker-compose.yml but I fixed them and it actually works.

However, given this docker-compose.yml:

version: "2"
services:
    app:
        build:
            dockerfile: Dockerfile-dev
            context: ./
        image: myapp
        ports:
            - '3000:3000'
            - '8081:8081'
            # needed by debugger
            - '8080:8080'
        volumes_from:
            - code

    debugger:
        image: node-debug
        depends_on: [app]
        # `service` instead of `container` for an easier cold start
        network_mode: 'service:app'
        volumes_from:
            - code

    code:
        image: node
        volumes:
            - './code:/app/code'

And this Dockerfile for node-debug:

FROM node
RUN npm install -g node-inspector
EXPOSE 8080 # I also tried without exposing the port
ENTRYPOINT ["node-debug"]

When I run docker-compose up, my app start and run as expected, BUT I cannot access the debugger even if I can see the message about listening on http://127.0.0.1:8080/?port=5858.

Any ideas?

Vanuan commented 8 years ago

The crucial part is to use --web-host 0.0.0.0 node-debug option. By default it listens only to localhost and thus is not available for publishing.