I am facing an similar error and working with microsoft support to see if they could help me to fix the issue that you raised here
Azure App Service Fails to Start - Docker Flask - Can not Find File - Only with Azure Container Registry Deployment
Problem :
Can not deploy Flask web application from Azure Container Registry even though I can deploy the same Docker image from Dockerhub and have it work. Logs indicate that app.py is unable to be found, but this file definitely in the root directory.
Additional Details
Pulling the image from Azure Container Registry and running it works on my local machine and on the machines of others who have tested it.
I have another web application with Node.JS that when run the exact same way (Click on Container Repo Tag X -> Deploy as App Service), it works.
Azure App Service seems to be able to pull the image. My password, username, and repo name are all correct in the docs.
Image has been built and deployed to via Azure DevOps, just like how my Node.JS web application was, which works fine. I also built the image locally and uploaded it to the Azure Container Registry and it also did not work.
Logs
2021-10-18T04:37:59 Welcome, you are now connected to log-streaming service.
Starting Log Tail -n 10 of existing logs ----
/home/LogFiles/__lastCheckTime.txt (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/\_\_lastCheckTime.txt)10/18/2021 04:31:54
/home/LogFiles/kudu/trace/6ba5fa616921-fc3f7bd3-b836-44a9-8d5d-600950059871.txt (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/6ba5fa616921-fc3f7bd3-b836-44a9-8d5d-600950059871.txt)
2021-10-18T03:43:17 Startup Request, url: /api/vfs/site/wwwroot/?_=1634528185942, method: GET, type: request, pid: 69,1,5, ScmType: None
/home/LogFiles/kudu/trace/b3b774fbc187-7c732bb8-96d9-40e8-ad7f-1ea8613f4f67.txt (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/b3b774fbc187-7c732bb8-96d9-40e8-ad7f-1ea8613f4f67.txt)
2021-10-18T03:47:38 Startup Request, url: /api/logs/docker, method: GET, type: request, pid: 66,1,14, ScmType: None
/home/LogFiles/kudu/trace/d761cf22f5fd-f24732b7-0784-497f-b9ad-33e2c9f6ed01.txt (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/d761cf22f5fd-f24732b7-0784-497f-b9ad-33e2c9f6ed01.txt)
2021-10-18T03:46:22 Startup Request, url: /api/logs/docker, method: GET, type: request, pid: 75,1,6, ScmType: None
/home/LogFiles/2021_10_18_10-30-0-6_default_docker.log (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/2021_10_18_10-30-0-6_default_docker.log)
2021-10-18T04:04:38.054254895Z python3: can't open file './app.py': [Errno 2] No such file or directory
2021-10-18T04:07:04.487934266Z python3: can't open file './app.py': [Errno 2] No such file or directory
2021-10-18T04:09:40.127878191Z python3: can't open file './app.py': [Errno 2] No such file or directory
2021-10-18T04:12:06.374547930Z python3: can't open file './app.py': [Errno 2] No such file or directory
2021-10-18T04:31:57.588787249Z python3: can't open file './app.py': [Errno 2] No such file or directory
/home/LogFiles/2021_10_18_10-30-0-6_docker.log (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/2021_10_18_10-30-0-6_docker.log)
2021-10-18T04:31:55.398Z INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds
2021-10-18T04:31:55.422Z INFO - Starting container for site
2021-10-18T04:31:55.424Z INFO - docker run -d -p 8016:5000 --name capstonetest5_0_9c0281eb -e DOCKER_CUSTOM_IMAGE_NAME=capstonefinal:103 -e PORT=5000 -e WEBSITES_PORT=5000 -e WEBSITE_SITE_NAME=capstonetest5 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=capstonetest5.azurewebsites.net -e WEBSITE_INSTANCE_ID=8bae634d5da47ec1caf6ba245396aca0592deda150e06c87734fd81e9628db06 thylaw.azurecr.io/capstonefinal:103
2021-10-18T04:31:55.427Z INFO - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2021-10-18T04:31:57.539Z INFO - Initiating warmup request to container capstonetest5_0_9c0281eb for site capstonetest5
2021-10-18T04:31:58.580Z ERROR - Container capstonetest5_0_9c0281eb for site capstonetest5 has exited, failing site start
2021-10-18T04:31:58.584Z ERROR - Container capstonetest5_0_9c0281eb didn't respond to HTTP pings on port: 5000, failing site start. See container logs for debugging.
2021-10-18T04:31:58.598Z INFO - Stopping site capstonetest5 because it failed during startup.
/home/LogFiles/webssh/.log (https://capstonetest5.scm.azurewebsites.net/api/vfs/LogFiles/webssh/.log)
Ending Log Tail of existing logs ---
Starting Live Log Stream ---
2021-10-18T04:38:59 No new trace in the past 1 min(s).
2021-10-18T04:39:59 No new trace in the past 2 min(s).
2021-10-18T04:40:59 No new trace in the past 3 min(s).
Dockerfile
Static layers
FROM alpine:3.7 AS skf-alpine37
MAINTAINER Glenn ten Cate <******@owasp.org>
Installing needed binaries and deps. Then removing unneeded deps:
RUN apk update --no-cache && apk add python3 python3-dev py3-pip bash git dos2unix
Dynamic layers
FROM skf-alpine37
MAINTAINER Glenn ten Cate <******@owasp.org>
RUN addgroup -g 1000 app
RUN adduser -u 1000 -G app -D -h /home/app app
RUN rm -rf /var/cache/apk/APKINDEX*
COPY ./ /home/app/XSS
Switching to the new app location:
WORKDIR /home/app/XSS
RUN chown -R app:app /home/app/XSS
Switching to the limited user
USER app
Installing needed binaries and deps
RUN pip3 install --no-cache-dir --user -r requirements.txt
Fixing Windows line endings for our students:
RUN find . -name ".sh" -o -name ".py" -o -name ".css" -o -name ".js" | xargs dos2unix
Setting chmod +x on the scripts:
RUN find . -name ".sh" -o -name ".py" -o -name "Dockerfile" | xargs chmod +x
Starting the actual application:
ENTRYPOINT [ "python3", "./app.py" ]
Azure Container Registry
Azure App Service
3 answers
Sort by: Most helpful
-
-
TJ challstrom 1 Reputation point
2022-01-31T16:46:30.237+00:00 We ran into this too - for some reason our images were completely empty. Completely delete the repository in ACR and rebuild/push the image. Might fix your problem.
-
Dinesh Kumar Meganathan 1 Reputation point
2022-01-31T17:57:50.82+00:00 From the error logs
2021-10-18T04:31:58.580Z ERROR - Container capstonetest5_0_9c0281eb for site capstonetest5 has exited, failing site start
2021-10-18T04:31:58.584Z ERROR - Container capstonetest5_0_9c0281eb didn't respond to HTTP pings on port: 5000, failing site start. See container logs for debugging.Have you created the error handling
I looked into it, and normally we should see 404 or something for the /robots933456.txt path, which is used to check if the container can serve/respond
Failing to this HTTP ping request the App service won't continue to run the container image