question

tlcs-0192 avatar image
1 Vote"
tlcs-0192 asked ·

Azure App Service using a Windows container Failing and restarting - Modify Compute System failed

Hey all,

This question has been asked before, but the answer didn't seem to work for me. I've set up a simple hello_world (Python, Flask) windows container with the following image:

mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

Unfortunately every time I try to start it up I get the following:

21/04/2020 09:54:59.213 INFO - Site: - Start container succeeded. Container: xxx
21/04/2020 09:55:02.268 INFO - Site: - Attempting to stop container: xxx
21/04/2020 09:55:03.126 INFO - Site: - Container stopped successfully. Container Id: xxx
21/04/2020 09:55:03.126 INFO - Site: - Purging pending logs after stopping container
21/04/2020 09:55:03.158 INFO - Site: - Purging after container failed to start
21/04/2020 09:55:03.158 ERROR - Site: - Unable to start container. Error message: Modify Compute System failed.

The container works great local, but once its in the app service it won't start. I tried running it with different windows images but no luck. Anybody have some advice?

Kind regards,

tlcs

azure-webapps
· 3
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you share your Dockerfile @tlcs-0192 along with the different windows images you attempted to use?

You can also email me at AzCommunity[at]microsoft[dot]com ATTN Ryan with your subscription id and app name so we can work more closesly with you.

1 Vote 1 ·

Hey @ryanchill !

The docker file I used:

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

FROM python:3.8

COPY . /app

WORKDIR /app

EXPOSE 5000

RUN pip install -r requirements.txt

ENTRYPOINT ["python"]

CMD ["app.py"]

Windows images I tried:

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2-windowsservercore-ltsc2016

FROM mcr.microsoft.com/windows/servercore:ltsc2019

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019

I also emailed you at the above mentioned email address with the subscription id and app name. Let me know if there is anything else you require!

0 Votes 0 ·

Hi @tlcs-0192, I did get your email and I'm seeing if I can replicate your issue. In the meantime, try the following dockerfile as the windows image is cached on Azure. Let me know if that works for you or not.


FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8 FROM python:3.8


COPY . /app
WORKDIR /app
EXPOSE 5000


RUN pip install -r requirements.txt


ENTRYPOINT ["python", "app.py"]



0 Votes 0 ·

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered ·

@tlcs-0192 took long enough but I got a docker image that works. For background, Windows Container images are still a preview feature and more than likely the cause of the issue. The python base image I got working is one based on the cached instances Azure has right now. I'm no docker expert but I think

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
FROM python:3.8

was causing an issue. See my docker image below. I did verify this works on both Windows and Linux app service plans so enjoy. Hope this helps get your unblocked.

7886-2020-05-01-18-33-53-dockerfile-hello-flask-visual.png

 FROM python:3.8-windowsservercore-1809
 COPY . /app
 WORKDIR /app
 RUN pip install -r /app/requirements.txt
 EXPOSE 5000
 CMD ["python", "app.py"]

app.py

 from flask import Flask
 app = Flask(__name__)
    
 @app.route("/")
 def home():
     return "Hello, Flask!"
    
 if __name__ == "__main__":
     app.run(debug=True,host='0.0.0.0')



· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It works perfectly now, thank you so much!

Kind regards,

tlcs

0 Votes 0 ·