2

I am trying to follow this tutorial DEPLOY PYTHON WEB APP IN WEB APP FOR CONTAINERS

I have cloned the project, tested it manually and it worked fine. The tutorial recommended to push the docker image on the docker hub. Instead of that I created the container registry on azure itself and pushed the docker image in azure container registry. I haven't enabled the admin used in azure container registry so no need to worry about credentials as its not private registry.

I then used the command mentioned in the tutorial and started the web app but when I try to access the url, it shows Service Unavailable. I do not have any idea on what wrong I am doing here.

Please help. Thanks

DOCKERFILE

FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7

ENV LISTEN_PORT=8000
EXPOSE 8000

COPY /app /app
9
  • Did you build your image as a container and make sure the container is running? docker ps Commented Aug 20, 2018 at 15:00
  • @Jayendran Where can I run the docker ps command in azure. Sorry I have less idea about azure but good in dockers.? Commented Aug 20, 2018 at 16:21
  • @Jayendran You were right, container failed while starting. I checked this in container settings -> logs on azure, but the problem I dont get is why the container is getting failed. It says ERROR - Container create failed for test-pyapi_0 with System.AggregateException, One or more errors occurred. InnerException: Docker.DotNet.DockerContainerNotFoundException, Docker API responded with status code=NotFound, response={"message":"No such image: mytestcr.azurecr.io/flask-quickstart:latest"}. Can you please help me with this. Thanks Commented Aug 20, 2018 at 16:56
  • @Jayendran It says no such image while the image is saved on azure container registry. I also tested this with docker hub and got the same error. Do you have any idea about this.? Thanks Commented Aug 20, 2018 at 16:58
  • @S Andrew could you share you DockerFile/Compose in your original Post. I think this is an error with dotnet package found similar issue here and here Commented Aug 21, 2018 at 1:59

1 Answer 1

1

For deploying Web Application on Azure container. The images are the import key.

When the images are in the public registry, you just need to follow the steps below:

  1. Create a resource group in Azure.
  2. Create a Service Plan.
  3. Create the Web Application with the image.

For more details, see Deploy a Docker/Go web app in Web App for Containers.

When the images are in the private registry, here make an example with Azure Container Registry.

You need one more step, set the container config for your web app like this:

az webapp config container set --name <app_name> --resource-group <resourceGroup_Name> --docker-custom-image-name <azure-container-registry-name>.azurecr.io/<image_name> --docker-registry-server-url https://<azure-container-registry-name>.azurecr.io --docker-registry-server-user <registry-username> --docker-registry-server-password <password>

For more details, see Use a Docker image from any private registry.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, it worked. I forgot to add one extra step which you mentioned, it was basically credentials for azure container registry. I just wanted to know, so lets if I add any other python module, like cryptography, I'll also have to include this in Dockerfile and rebuild it.?
@SAndrew Yes, the web app comes from the image, if you want to change, the image needs to rebuild first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.