I've created a Azure App Service using a custom Docker Image for Windows Containers. The image runs completely fine on my Windows machine using Docker Desktop.
However, the Azure container keeps restarting and failing.
Azure Deployment Log from Kudo:
05/04/2022 18:04:28.774 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Attempting to start container
05/04/2022 18:04:46.474 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Start container succeeded.
05/04/2022 18:04:52.593 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Attempting to stop container: 6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28. Site app-myappdockertest1
05/04/2022 18:04:52.593 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Shutdown container: 6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28
05/04/2022 18:04:52.611 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Attempting to remove container: 6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28
05/04/2022 18:04:52.992 INFO - Site: app-myappdockertest1 - Purging pending logs after stopping container
05/04/2022 18:04:52.992 INFO - Site: app-myappdockertest1 - [6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28] - Container removed successfully. Container Id: 6a0179c8984360af8ceecd4730b66112335c73c54aa0ead74a2651f9f0abcc28
05/04/2022 18:04:53.003 INFO - Site: app-myappdockertest1 - Purging after container failed to start
05/04/2022 18:04:53.003 ERROR - Site: app-myappdockertest1 - Unable to start container. Error message: One or more errors occurred.
I was unable to find any additional information to this error. Any idea to find detailed information about the error?
The image is based on the latest version of mcr.microsoft.com/dotnet/framework/wcf. It contains a .NET WCF service hosted in IIS
Solution for the issue after reviewing the information given by AjayKumar-MSFT:
The main issue was that I was using a not supported parent image. The image "mcr.microsoft.com/dotnet/framework/wcf" in its current version was based on "Windows Server Core 2022" while Microsofts supported images requires "Windows Server Core 2019" as of April 2022.
I've changed my Dockerfile to
FROM mcr.microsoft.com/dotnet/framework/wcf:4.8-windowsservercore-ltsc2019
and was able to solve the issue. The container starts without any error message.
However AjayKumar-MSFT's tips regarding memory usage were also helpful as I was getting OutOfMemoryExceptions after the application start.
As for as supported parent images, review the supported list.
--You may always, fetch more details on the errors, review the logs:
Navigate to https://.scm.azurewebsites.net/DebugConsole and click the LogFiles folder to see the individual log files.
--Navigate directly to https://.scm.azurewebsites.net/api/logs/docker to see metadata for the Docker logs.
--You may test with the listed parent image in the doc.
Additionally,
By default, if your container does not respond after 230 seconds, it will time out. (This time out can be increased by with the WEBSITES_CONTAINER_START_TIME_LIMIT app setting.) and be increased to 1800
Used the following base image mcr.microsoft.com/windows/servercore:ltsc2019 which seems to have solved the error for me.
Related
I have an azure function, I am using azure container registry image for the deployment but getting Azure runtime is unreachable. I have checked the docker logs from Kudu, it is throwing -
Pull Image successful, Time taken: 0 Minutes and 1 Seconds
2022-12-13T07:40:49.911Z INFO - Starting container for site
2022-12-13T07:40:49.912Z INFO - docker run -d --expose=80 --name <function_app>_0_e2779bae -e DOCKER_CUSTOM_IMAGE_NAME=/: -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=<function_app> -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=<function_app>.azurewebsites.net -e WEBSITE_INSTANCE_ID= -e WEBSITE_USE_DIAGNOSTIC_SERVER=False <image_path>
2022-12-13T07:40:49.913Z INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2022-12-13T07:40:50.683Z INFO - Initiating warmup request to container <function_app>_0_e2779bae_msiProxy for site <function_app>
2022-12-13T07:40:50.692Z INFO - Container <function_app>_0_e2779bae_msiProxy for site <function_app> initialized successfully and is ready to serve requests.
2022-12-13T07:40:50.693Z INFO - Initiating warmup request to container <function_app>_0_e2779bae for site <function_app>
2022-12-13T07:40:50.706Z ERROR - Container <function_app>_0_e2779bae for site <function_app> has exited, failing site start
2022-12-13T07:40:50.712Z ERROR - Container <function_app>_0_e2779bae didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2022-12-13T07:40:50.718Z INFO - Stopping site <function_app> because it failed during startup.
I have added docker url, username and password attributes in the app-settings and are correct. Can someone please help me out with the same?
Container <function_app>_0_e2779bae didn’t respond to HTTP pings on port: 80, failing site start.
There could be several reasons for the above error such as:
Allow the Port 8080 or 80 by adding the app setting as WEBSITES_PORT .
If it is the custom container, you have to give certain port number for routing the requests.
In Docker File, expose the above-mentioned port.
Refer to this MS Q&A Issue No 750525 regarding the similar error on Azure Functions Container Context and also many similar issues reported on GitHub Repositories such as 46401, 34451 for the solutions given by MSFT Azure Team.
I have tried several ways but got to know the reason at last.
The issue was with the dockerfile, but the error logs were not showing the actual cause.
Previously in the dockerfile we were using entrypoint and the code was not getting published to wwwroot
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "someapplication.dll"]
and then we modified the file to publish it to wwwroot
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
This resolved my problem.
i am new to azure container instance and just trying to test deploying a well
established image from dockerhub 'datascience-notebook'.
However, i kept getting this error
["start.sh","jupyter lab","--ServerApp.password='sha1:8....72b'"]
Error: Failed to start container dockertestjames, Error response: to create containerd task: failed to mount container storage: guest modify: guest RPC failure: failed to mount container root filesystem using overlayfs /run/gcs/c/aa4f851be9d3da8ee44c062ae03bc67b4c5937c57b83eacebddbe7375f902bdc/rootfs: no such file or directory: unknown
The settings are as such and it show be straight forward...
Appreciate any help if anyone could enlighten me.
Thank you !
This seems to be a known issue from Azure as mentioned by PradeepKommaraju-MSFT in this Microsoft Q & A thread :
While Azure Product team is working on the fix , the workaround for this scenario will be not to provide any command override . Once the Container is deployed you can connect and run the command inside the container.
I tested the same and it was successful like below :
This question already has answers here:
How to authenticate with Azure ACR from Azure container app service
(4 answers)
How to configure an Azure app service to pull images from an ACR with terraform?
(2 answers)
Azure Container Registry authorization for Azure Web App
(1 answer)
Closed 1 year ago.
I'm deploying an App Service in Azure that has a related container image. I created both the App Service and the image with the Owner user (the only one I have). Still, when I start the App Service I get an error that the "image is not authorized" (see below). How to fix this problem?
The image is created and stored in the registry with no issues.
2021-07-26T15:03:31.157Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2021-07-26T15:03:37.000Z INFO - Stopping site sofiana because it failed during startup.
2021-07-26T15:06:32.588Z INFO - Starting container for site
2021-07-26T15:06:32.590Z INFO - docker run -d -p 8081:8081 --name sofiana_1_e0d93acf_msiProxy -e PORT=8081 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=sofiana.azurewebsites.net -e WEBSITE_INSTANCE_ID=4c49e5ee1c9d26e3d207f81f51be02bb2c4d67839b9f7b25c24fceef7fd9b44e appsvc/msitokenservice:2007200210
2021-07-26T15:06:32.592Z INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2021-07-26T15:06:43.616Z INFO - Pulling image from Docker hub: sofacr.azurecr.io/nginx-visualbank:latest
2021-07-26T15:06:43.697Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://sofacr.azurecr.io/v2/nginx-visualbank/manifests/latest: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information."}
2021-07-26T15:06:43.700Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2021-07-26T15:06:49.634Z INFO - Stopping site sofiana because it failed during startup.
You need to auth against the repository
az acr login --name sofacr --subscription AZURE-SUB
I have deployed the simple Hello-world docker image in azure web app for testing as my original application is failing with the similar issue. The hello-world image will download successfully but fail to start with below error:
INFO - Initiating warmup request to container container123445_0_2ec54b26 for site container123445
ERROR - Container container123445_0_2ec54b26 for site container123445 has exited, failing site start
ERROR - Container container123445_0_2ec54b26 didn't respond to HTTP pings on port: 80, failing site start. See containerlogs for debugging.
INFO - Stoping site container123445 because it failed during startup.
When I browse the webapp URL, it gives me "application error" page. Its very simple deployment, but failing.
I have a 3rd party Tomcat server image/container running in LinuxVM on Azure. The LinxVM actually started as 2 images(NGINX loadbalancer) running via a docker-compose script, but to test this on a webapp I've wittled down to just the single tomcat image. Now, the compose script uses the key:
ports:
- 80:8090
- 8445:8443
In the VM I can run the docker-compose script and hit http://mypage:80 and it works just fine. I can also run:
docker run -d -p <somePort>:8090 --name tomcat_1 <myrepo/myimage>
I can then access my site with http://mypage:<somePort> regardless of which port I want to map to the container. This all works great.
Now, with the Azure Web App, I'm using an Azure Web App for Containers --> Docker Compose (Preview). My compose script looks something like:
version: "3.0"
services:
pdfd-tomcat:
image: <myrepo/myimage>
build:
context: .
args:
INCLUDE_DEMO: 'true'
LIBRE_SUPPORT: 'false'
HTML_SUPPORT: 'false'
container_name: Blackbox
environment:
TRN_PDFNET_KEY:
TRN_DB_TYPE: SQLITE
TRN_DB_LINK:
TRN_BALANCER_COOKIE_NAME: HAPROXID
TRN_DEBUG_MODE: 'false'
ports:
- 80:8090
- 8445:8443
I've exposed 80:8090 because I've read that Azure Web Apps only expose port 80 and 443 by default. However, I cannot access this site from any port once the web app is spun up. I've verified running this same compose script works in a VM. Now, when I hit the web app logs, I see this:
Status: Image is up to date for <myrepo/myimage>
2018-06-17 05:38:41.298 INFO - Starting container for site
2018-06-17 05:38:41.298 INFO - docker run -d -p 18455:8090 --name tomcat_1 -e WEBSITE_SITE_NAME=<mywebsite> -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=<stuff goes here>
2018-06-17 05:38:41.298 INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2018-06-17 05:38:56.994 INFO - Started multi-container app
2018-06-17 05:38:57.008 INFO - Container tomcat_1 for site <mywebsite> initialized successfully.
So, it seems that it's trying to map external port: 18455 to my internal 8090 port. Why? Also, if I try to hit my site via that port, I can't. Each time the app deploys/restarts it maps a different external port.
Also, if I retroactively go to 'Application Settings' and use the key/value: WEBSITES_PORT:<current externally mapped port> it has literally no effect. Then if the app gets restarted/redeployed, I can see that WEBSITES_PORT:<port> is what the previous port was mapped with, but since that changes every deployment, the current external port and the WEBSITES_PORT values never match. I don't even know if it works to begin with.
How the heck do get this working in a deterministic manner? I can supply other material if needed.
This boiled down to a permissions issue when using Tomcat 9.0+ with Docker.
Permission problem while running tomcat as a non-root user
The Dockerfile would create a new usergroup and add a user, then give that user permissions in the folders where Tomcat existed. If you jumped into the container via docker exec /bin/bash and checked permissions, they all seemed perfectly fine. However, logs would show that Tomcat couldn't gain access to those folders.
Once I implemented the fix as described by Empinator in the link everything worked (using root also worked).