{"id":199901,"date":"2020-09-14T09:17:05","date_gmt":"2020-09-14T01:17:05","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=199901"},"modified":"2020-09-01T16:17:48","modified_gmt":"2020-09-01T08:17:48","slug":"docker-node","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/docker-node.html","title":{"rendered":"Docker\u5982\u4f55\u9ad8\u6548\u90e8\u7f72Node\u5e94\u7528\uff1f\u770b\u8fd9\u91cc"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u4e00\u4e2a\u5408\u7406\u5e76\u4e14\u9ad8\u6548\u7684\u90e8\u7f72\u65b9\u6848\uff0c\u4e0d\u4ec5\u80fd\u591f\u5b9e\u73b0\u5feb\u901f\u5347\u7ea7\uff0c\u5e73\u6ed1\u5207\u6362\uff0c\u8d1f\u8f7d\u5747\u8861\uff0c\u5e94\u7528\u9694\u79bb\u7b49\u90e8\u7f72\u7279\u6027\uff0c\u800c\u4e14\u914d\u6709\u4e00\u5957\u6210\u719f\u7a33\u5b9a\u7684\u76d1\u63a7\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e00\u4e2a\u5408\u7406\u5e76\u4e14\u9ad8\u6548\u7684\u90e8\u7f72\u65b9\u6848\uff0c\u4e0d\u4ec5\u80fd\u591f\u5b9e\u73b0\u5feb\u901f\u5347\u7ea7\uff0c\u5e73\u6ed1\u5207\u6362\uff0c\u8d1f\u8f7d\u5747\u8861\uff0c\u5e94\u7528\u9694\u79bb\u7b49\u90e8\u7f72\u7279\u6027\uff0c\u800c\u4e14\u914d\u6709\u4e00\u5957\u6210\u719f\u7a33\u5b9a\u7684\u76d1\u63a7\u3002<\/p>\n kubernetes \u628a Node \u5e94\u7528\u89c6\u4f5c\u4e00\u4e2a\u670d\u52a1\u7aef\u5e94\u7528\u7684\u9ed1\u76d2\u5b50\uff0c\u5b8c\u7f8e\u5339\u914d\u4e86\u4ee5\u4e0a\u6761\u4ef6\uff0c\u8d8a\u6765\u8d8a\u591a\u7684\u56e2\u961f\u628a node \u90e8\u7f72\u5728 k8s \u4e0a\u3002<\/p>\n \u4f46\u5728\u6b64\u4e4b\u524d\uff0c\u9700\u8981\u5148\u628a Node \u5e94\u7528\u8dd1\u5728\u4e00\u4e2a Docker \u5bb9\u5668\u4e0a\uff0c\u8fd9\u4e5f\u662f\u672c\u7ae0\u7684\u4e3b\u9898\u3002<\/p>\n \u4e00\u4e2a\u7b80\u5355\u7684 Node \u5e94\u7528<\/strong><\/div>\n \u300cindex.js\u300d<\/strong><\/span><\/div>\n \u4e00\u4e2a hello, world \u7248\u7684 Node Web App<\/p>\n \r\nconst http = require('http') \r\n \r\nconst app = async (req, res) => { \r\n res.end('hello, world') \r\n} \r\n \r\nhttp.createServer(app).listen(3000, () => console.log(3000)) \r\n<\/pre>\n |