Azure Web App on Linux: “Error: Container didn't respond to HTTP pings on port: 8080” - when using: “start”: “pm2 start server.js”

后端 未结 3 708
-上瘾入骨i
-上瘾入骨i 2021-01-13 15:31

My App Service Linux instance crashes if my node app is using the start script: \"start\": \"pm2 start server.js\":

2019-04-15 11:36:34.432 ERRO         


        
相关标签:
3条回答
  • 2021-01-13 15:34

    Are we trying to ping on PORT 8080? The problem here is that port 8080 is not exposed, so when we attempt to ping the container, we aren't pinging on a port on which the container is listening.

    There are a couple of ways to resolve this.

    1. Use the EXPOSE instruction in your Dockerfile to expose port 8080.
    2. Use the WEBSITES_PORT app setting with a value of "8080" to expose that port.

    You can refer the below mentioned articles:

    https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment?view=azure-devops

    https://blogs.msdn.microsoft.com/waws/2017/09/08/things-you-should-know-web-apps-and-linux/

    0 讨论(0)
  • 2021-01-13 15:39

    I was having the same issue. When I changed the code in my server.js file to the below it succesfully ran:

    const port = process.env.port || 8080;
    

    After redeploying to Azure it is now working.

    0 讨论(0)
  • 2021-01-13 15:43

    Try adding the application setting PORT with the value of whatever port your app is listening on.

    Ref: https://github.com/MicrosoftDocs/azure-docs/issues/34451

    0 讨论(0)
提交回复
热议问题