Tyler Brinks
Tyler Brinks

Reputation: 1201

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!

Upvotes: 4

Views: 2685

Answers (1)

4c74356b41
4c74356b41

Reputation: 72171

Pretty sure this is not yet supported, you can vote for this feature here.

Also, looking at the docs, it appears port 80 should be working just fine (see this example).

Upvotes: 2

Related Questions