节点J未在Docker Environment Pin

时间:2017-10-25 12:44:38

标签: node.js express docker

我的NodeJS未在Docker环境中运行。具体来说,我的express模块未加载到Docker容器中。

这是我到目前为止的设置:

server.js

var express = require('express')

var app = express();

app.get('/', function (req, res) {
    res.end('Hello world');
})

var server = app.listen(9005, function () {
    var host = server.address().address
    var port = server.address().port

    console.log("Example app listening at http://%s:%s", host, port)
})

Dockerfile

 FROM stefanscherer/node-windows:7.6.0-nano

 # Create app directory
 RUN mkdir -p /app
 WORKDIR /app

 # Install app dependencies
 COPY package.json /app/
 RUN npm install

 # Bundle app source
 COPY . /app

CMD ["node","server.js"]
EXPOSE 9005

1 个答案:

答案 0 :(得分:0)

您确定在package.json的依赖项部分中包含了express吗?