node.js - Mapping Ports with Azure Docker Containers
问题描述
Is there a way in Azure to map ports to a Docker container? I have an image I've build using Node + Express that takes in an environmental variable to determine which port to listen on. In Azure, using any port over 1024 seems to work fine, but below that the process raises an uncaughtException error. Obviously I'd like to use port 80 (and 443) for production. I'd like to map port 80 to a configured port within my container (e.g. docker run -p 80:3000. How can I accomplish this within Azure.
The error raised when mapping to port 80 is:
server port is 80
{ Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (net.js:1241:19)
at listenInCluster (net.js:1306:12)
at Server.listen (net.js:1394:7)
at Function.listen (/home/node/app/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/home/node/app/dist/app.js:34:5)
at Module._compile (internal/modules/cjs/loader.js:805:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:816:10)
at Module.load (internal/modules/cjs/loader.js:672:32)
at tryModuleLoad (internal/modules/cjs/loader.js:612:12)
at Function.Module._load (internal/modules/cjs/loader.js:604:3)
code: 'EACCES',
errno: 'EACCES',
syscall: 'listen',
address: '0.0.0.0',
port: 80 }
Thank you in advance for the help!
解决方案
推荐阅读
- asp.net - 我的程序架构有意义吗?AngularJS + ASP.NET Web API + SQL Server
- c++ - SDL 从一个类渲染矩形
- swift - Swift Codable:如何从嵌入数据中创建多个对象
- ruby-on-rails - Rails 邮件程序不发送电子邮件
- php - 试图从命名空间加载类
- css - 如何设置全宽和响应式背景图像
- html - 响应性:div 根据内联 div 调整大小
- javascript - JavaScript 中对 socket.io 的订阅过多
- git - 如何使用命令行更新放置在我的 Github 存储库中的文件
- python - lxml html.parse 返回错误读取文件未能加载外部实体