Error when running docker container Django app

Lucas Shaw 1 Reputation point
2022-12-12T19:04:58.093+00:00

Hi,

I am trying to publish a docker container on Azure, It's a Django app however I keep receiving the below errors:

Container shawjournal_0_6deb178e couldn't be started: Logs = 2022-12-10T10:32:28.141764570Z exec /usr/local/bin/python3: exec format error

The below is from the log stream:

  • 2022-12-12T18:50:33.663782050Z exec /usr/local/bin/python3: exec format error
    2022-12-12T18:50:52.266Z ERROR - Container shawjournal_0_b21a049f for site shawjournal has exited, failing site start
    2022-12-12T18:50:52.281Z ERROR - Container shawjournal_0_b21a049f didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.

I looked at the following and decided to contact support as the many attempts I made haven’t worked -

Please also see my stack overflow question for more details and error screenshots - https://stackoverflow.com/questions/74734390/azure-application-error-when-trying-to-run-django-web-app.

I am using an M1 Mac and from what I’ve seen the issue could be with the system architecture but I want to refrain acting upon that until I am sure, as changing this on Docker might cause further issues. I have included DOCKER_REGISTRY_SERVER_PASSWORD …URL and …USERNAME in which I used my DOCKER login credentials, which hasn’t solved this issue.

Dockerfile contains:
...

EXPOSE 80  
EXPOSE 8080  
EXPOSE 8081  

..

Appreciate any help,

Many thanks

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

2 answers

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-12-15T21:54:01.553+00:00

    LucasShaw-6211, Following-up on this, I understand you have referred to multiple threads/solutions on this. If you haven't reviewed these already, please try these:

    From the initial investigation, I see that you’re exposing multiple different ports.
    By default, App Service assumes your custom container is listening on port 80. If your container listens to a different port set it using this App Setting.
    E.g., 8000. || I see you have added port 9000 and 8000 in a few settings.

    Just to highlight the difference: app settings/variable- PORT (default) vs WEBSITES_PORT (it’s for custom containers).

    This doc shows supported and unsupported Docker Compose configuration options ( build (not allowed))

    Checkout the App Service Django samples here and steps outlined in this doc Django Deployment on App Service Linux for more info.


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-12-23T19:12:40.157+00:00

    most likely you used an arm64 image instead of amd64 image. normally on a Mac m1 you would use arm64 images as they run native. but via rosetta you can run amd64 images also.

    you can also build multi-arch containers.

    https://learn.microsoft.com/en-us/azure/container-registry/push-multi-architecture-images


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.