I have a simple nodeJs app which is uses express frame work. I can successfully run this app inside a docker container. 

I need to debug this app remotely from VS code how to do that.

the following steps I took to debug remotely inside a 

simple node app.js
------------------

```
var express = require('express');

var app = express();

var fs = require('fs')
var logger = fs.createWriteStream('log.txt', { flags: 'a'  })

app.get('/', function(reg, res){

    res.send('Home page ' + reg.params.id);
});

app.get('/:id', function(reg, res){

    if(reg.params.id != 'favicon.ico')
        logger.write( ' ' + reg.params.id);

    res.send('Home page ' + reg.params.id);
});

app.listen(3000, function(){

    console.log('A test server is running');
})

```

VScode launch.json
------------------

```
{
    "type": "node",
    "request": "attach",
    "name": "Attach to Process",
    "port": 5858,
    "address": "192.168.1.10",
    "restart": false,
    "sourceMaps": false,
    "localRoot": "${workspaceRoot}/",
    "remoteRoot": "/app/"
 }

```

Dockerfile
----------

```
FROM node:7.2.0-alpine
RUN mkdir /app
WORKDIR /app
COPY . /app
RUN npm install
WORKDIR /app/src
EXPOSE 8080
EXPOSE 5858
CMD ["node","--debug-brk=5858","app.js"]

```

**docker build command**

```
docker build -t remotedebug .

```

**docker run command**

```
docker run --rm --name test -p8080:3000 -p5858:5858 remotedebug

```

after running the docker it console outputs a message

> 
> Debugger listening on 127.0.0.1:5858
> 
> 
> 

but I cant access the node app from localhost:8080 and cannot debug from VScode.