2

I've released a bunch of Docker apps on Azure App Services in the past, but for some reason, after creating a new build and release pipeline in Azure DevOps, my Docker containers won't run in an Azure App Service. These particular containers are on the Linux flavor.

Switching between various Docker images, any built with the old pipeline work, but ones built with the new pipeline do not.

When I copy-paste the exact command from the App Service's log file into my local command line, it works just fine. I'm able to access the site as the same port as the App Service.

Here is my Dockerfile:

FROM node:8.12.0-alpine

ARG BUILD_VERSION
ENV BUILD_VERSION ${BUILD_VERSION}

ENV LOCAL_DEVELOPMENT false
ENV NODE_ENV production

ARG STAGING_DIRECTORY

WORKDIR ~/
COPY ${STAGING_DIRECTORY} .

ENTRYPOINT node . server ${BUILD_VERSION}
Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62

2 Answers2

0

While I can't say for sure what's causing your issue, it's probably because there's an error running the ENTRYPOINT command in your container.

Is it possible you're using a docker-compose.yml file? Your COPY command can't have ../ or anything outside of the current directory. To do this, you'll want to change the context via either your docker build command or the docker-compose.yml file.


I had a similar issue where I was changing the WORKDIR and then doing a COPY . . instead of leaving WORKDIR at ~/ and doing COPY ${STAGING_DIRECTORY} ..

In Azure, go to your "Container settings". Down below, you'll see a log. You can use this log to determine the issue you're having.

It will look something like this:

2018_10_16_RD00155DFE4342_default_docker.log:
2018-10-16T16:14:33.084558195Z     throw err;
2018-10-16T16:14:33.084568395Z     ^
2018-10-16T16:14:33.084576596Z 
2018-10-16T16:14:33.084584396Z Error: Cannot find module '/home/vsts/work/1/a/publish'
2018-10-16T16:14:33.084592096Z     at Function.Module._resolveFilename (module.js:548:15)
2018-10-16T16:14:33.084599797Z     at Function.Module._load (module.js:475:25)
2018-10-16T16:14:33.084607297Z     at Function.Module.runMain (module.js:694:10)
2018-10-16T16:14:33.084614697Z     at startup (bootstrap_node.js:204:16)
2018-10-16T16:14:33.084622297Z     at bootstrap_node.js:625:3

2018_10_16_RD00155DFE4342_docker.log:

2018-10-16 16:14:01.928 ERROR - Container [CONTAINER_NAME] for site [APP_SERVICE_NAME] has exited, failing site start
2018-10-16 16:14:27.665 INFO  - Starting container for site
2018-10-16 16:14:27.666 INFO  - docker run -d -p 26257:80 --name [CONTAINER_NAME] -e DOCKER_CUSTOM_IMAGE_NAME=[...]

2018-10-16 16:14:29.735 ERROR - Container [CONTAINER_NAME] for site [APP_SERVICE_NAME] has exited, failing site start
2018-10-16 16:14:31.998 INFO  - Starting container for site
2018-10-16 16:14:31.999 INFO  - docker run -d -p 3225:80 --name [CONTAINER_NAME] -e DOCKER_CUSTOM_IMAGE_NAME=[...]

2018-10-16 16:14:34.009 ERROR - Container [CONTAINER_NAME] for site [APP_SERVICE_NAME] has exited, failing site start

The *_default_docker.log file has the error your Docker file spouts while *_docker.log has the generic error message from Azure.

Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
0

I experienced this issue while deploying a NextJS app to Azure Web Service.

When the app starts I get the below logs:

2023-07-20T23:56:13.079Z ERROR - Container myapp-web_0_4d3b01f2 for site myapp-web has exited, failing site start
2023-07-20T23:56:13.089Z ERROR - Container myapp-web_0_4d3b01f2 didn't respond to HTTP pings on port: 3000, failing site start. See container logs for debugging.
2023-07-20T23:56:13.092Z INFO  - Stopping site myapp-web because it failed during startup.

Here's how I solved it:

All I had to do was to add a new Application Settings under Configuration for WEBSITES_PORT equal to the port my app is listening on, which is port 3000, so I had:

WEBSITES_PORT
3000

And then I redeployed the app from my CICD tool and it worked fine onwards.

Promise Preston
  • 24,334
  • 12
  • 145
  • 143