问题
I have followed the tutorials for building a .net core web application into a docker image, publishing to an azure container registry, and then I have setup my VSTS Release template to deploy the container to the app service.
This all appears to work, I can view my image in the container registry, and the deployment appears to succeed - but when navigating to the app service site, all I get is an HTTP 503 - Service unavailable.
The app service is started, I can see deployments in my file system via bash - so I wondered if I am missing something?
I do not have a 'startup' command in any of my templates, I wondered if it could be this?
The site works perfectly from VS2017, including debugging via docker, so it really is just a case of... how do I get the App Service to actually load and execute the image?
Thank you!
EDIT
Further to this, I have got access to the docker diagnostics logs which claim "image operating system "windows" cannot be used on this platform".
My base image is the microsoft/aspnetcore:2.0 image, which runs perfectly fine on my linux container in my development environment... but appears to not work in the Linux App Service?
Is the aspnetcore:2.0 base image not suitable for a linux app service?
回答1:
I ended up resolving this week, hopefully the answer will help others.
When using VSTS Hosted build agents to produce images running off the docker base microsoft/aspnetcore:latest - unless you use the (Linux Preview) hosted build agent, you will get produced a windows container, which will not run on the linux app services.
Once I switched to using the hosted linux build agent, the container successfully loads, and my issue is resolved.
回答2:
Another solution for the same error message:
Try microsoft/aspnetcore (without the tag/version :2.0) as image. If that doesn't work, check the docker logs as mentioned above and look for a solution based on the exact error (usually a missing dependency).
来源:https://stackoverflow.com/questions/45940045/azure-app-service-docker-container-service-unavailable