i am trying to upload django app at microsoft azure using their solution app services for containers. The APP without docker is working perfectly, after i added docker it's working locally but when i use microsoft container registry and upload it to and then try to use their app for containers solution it doesn't work. I need some help in here:
I created basic django restapiframework. Didn't add anything in there. After that i checked if it's working locally and it's working perfectly. After that i uploaded it on microsoft azure web app (not for cointaners) and it worked perfectly. After that i tried to add docker to my project and use microsoft azure web services for containers.
Below is my docker code and commands i try to use for locally:
DockerCompose:
version: '3.7'
services:
web:
build: .
command: bash -c "python manage.py makemigrations && python manage.py migrate --run-syncdb && python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
volumes:
- ./django_dashboard:/usr/src/django_dashboard
ports:
- 8000:8000
env_file:
- ./.env.dev
DockerFile:
FROM python:3.6
# set work directory
WORKDIR /usr/src
# install dependencies
RUN pip install --upgrade pip
COPY requirements.txt /usr/src/requirements.txt
RUN pip install -r requirements.txt
# set work directory
WORKDIR /usr/src/django_dashboard
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1 #Prevents Python from writing pyc files to disc (like python -B)
ENV PYTHONUNBUFFERED 1 #Prevents Python from buffering stdout and stderr (like python -u)
# copy project
COPY . /usr/src/django_dashboard/
Tree of my files
├── backend
│ └── django_dashboard
│ ├── db.sqlite3
│ ├── django_dashboard
│ │ ├── asgi.py
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-36.pyc
│ │ │ ├── settings.cpython-36.pyc
│ │ │ ├── urls.cpython-36.pyc
│ │ │ └── wsgi.cpython-36.pyc
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── Dockerfile
│ ├── __init__.py
│ ├── manage.py
│ ├── requirements.txt
│ └── rest
│ ├── admin.py
│ ├── apps.py
│ ├── __init__.py
│ ├── models.py
│ ├── __pycache__
│ │ ├── admin.cpython-36.pyc
│ │ ├── __init__.cpython-36.pyc
│ │ ├── models.cpython-36.pyc
│ │ ├── serializers.cpython-36.pyc
│ │ └── views.cpython-36.pyc
│ ├── serializers.py
│ ├── tests.py
│ └── views.py
├── docker-compose.yml
├── frontend
│ ├── Dockerfile
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ └── index.html
│ ├── README.md
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── components
│ │ └── Modal.js
│ ├── index.css
│ ├── index.js
│ └── logo.svg
└── README.md
To run it locally I am using:
docker-compose build --no-cache
docker-compose up
AFter that i am following this: https://learn.microsoft.com/bs-latn-ba/azure/container-instances/container-instances-tutorial-prepare-acr
and next things i am trying to run app services from their portal and i get in the logs:
2020-03-16 15:10:06.070 INFO - Starting container for site
2020-03-16 15:10:06.071 INFO - docker run -d -p 1219:8000 --name MYWEBSITE -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=8000 -e WEBSITE_SITE_NAME=MYWEBSITE -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=MYWEBSITE.azurewebsites.net -e WEBSITE_INSTANCE_ID=f2b41f3b5bb846770d96154839b55ad19f2b5bc4fef2a60a950ee081118ef8b0 MYWEBSITE.azurecr.io/MYWEBSITE:1v
2020-03-16 15:10:06.071 INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2020-03-16 15:10:33.890 INFO - Initiating warmup request to container MYWEBSITE for site MYWEBSITE
2020-03-16 15:10:34.336 ERROR - Container MYWEBSITE for site MYWEBSITE has exited, failing site start
2020-03-16 15:10:34.656 ERROR - Container MYWEBSITE didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2020-03-16 15:10:34.926 INFO - Stoping site MYWEBSITE because it failed during startup.
Replaced name of the website with word MYWEBSITE
What am I doing wrong? Thanks for you help.