Azure app service docker container 'Service Unavailable'
M

2

6

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?

Mandle answered 29/8, 2017 at 13:8 Comment(3)
Further to this, I have got access to the 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?Mandle
Are you able to share the tutorial link you're following?Coplin
I followed various to piece the journey together, but to start off my build and release templates I used the Azure portal continuous delivery blade, and then modified to use Azure container registry.Mandle
M
6

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.

Mandle answered 1/9, 2017 at 18:32 Comment(4)
This was helpful! For others that come here, the docker logs can be found in Kudu: YOURSITE.scm.azurewebsites.net and click "docker logs". This opens a JSON file; copy-paste the link in the JSON file.Chaucerian
@Chaucerian thanks a lot for your message. It saved my day!Eon
@Mandle so if my VSTS is building an ASP.NET "microsoft/aspnet" image it doesn't work with Azure Web App for Containers, right? Then what should I use?Crocker
@Hazz - I believe only .net core distributions will work in an Azure App Service because the underlying host is linux (At least when I was using them it seemed to be..) - so you would need to use microsoft/aspnetcore. If they have added support for Windows Server 2016 based containers into App Services then it would work. I believe this was coming at some point but do not believe it is there just yet. I have since swapped over to using Azure Container Services, but this is Kubernetes on Linux too for windows based containers you are going to need to build your own docker host I would think.Mandle
K
0

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).

Kulun answered 4/4, 2018 at 8:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.