My NodeJS is not running in Docker environment. Specifically, my express
module is not loaded within the Docker container.
This is my setup so far:
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
您确定在 package.json 的依赖项部分中包含了 express 吗?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.