标签:received require handler remote 目录 receive you address response
1.在同级目录编辑app.js文件
文件内容如下
const http = require(‘http‘); const os = require(‘os‘); console.log("Kubia server starting...."); var handler = function(request, response) { console.log("Received request from " + request.connection.remoteAddress); response.writeHead(200); respose.end("You‘ve hit " + os.hostname() + "\n") }; var www = http.createServer(handler); www.listen(8080)
2.在同级目录编写Dockerfile文件
FROM node:7
ADD app.js /app.js
ENTRYPOINT ["node", "app.js"]
3.运行Dockerfile文件
docker build -t kubia .
标签:received require handler remote 目录 receive you address response
原文地址:https://www.cnblogs.com/S--S/p/11692121.html