Run the below commands, all were successful, but can't open the web app on browser, how to fix it?
virtualenv .venv
.venv\Scripts\activate
pip install Django
django-admin startproject demoproject
python manage.py runserver
--notes: checked the web app was running at http://127.0.0.1:8000/
pip freeze > requirements.txt
--notes: add file "Dockerfile"
--notes: add file ".dockerignore"
docker build -t demoproject:v1.0 .
az login
az acr login --name xxtestcr
docker tag demoproject:v1.0 xxtestcr.azurecr.io/demoproject:v1.0
docker push xxtestcr.azurecr.io/demoproject:v1.0
az acr update -n xxtestcr --admin-enabled true
az container create -g xxtestrg --name test-ci --image xxtestcr.azurecr.io/demoproject:v1.0 --ports 80 443 --cpu 1 --memory 1.5 --dns-name-label xxtest-demoproject
Dockerfile:
FROM python:3.10.8
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN pip install -r requirements.txt
CMD python manage.py runserver 0.0.0.0:8000
.dockerignore
__pycache__
.venv/
Dockerfile
The app files:
Azure container instance overview:
But can't open the web app on browser: 4.147.67.11 xxtest-demoproject.australiaeast.azurecontainer.io
Your application listens on port 8000, but your ACI listens on ports 80 and 443.
You can listen on several ports with ACI but can't redirect to a single port. If you want to forward 80 and 443 to 8000, you'll need to use App Gateway, for example.
Please try with:
az container create -g xxtestrg --name test-ci --image xxtestcr.azurecr.io/demoproject:v1.0 --ports 8000 --cpu 1 --memory 1.5 --dns-name-label xxtest-demoproject
then try http://<ip/url>:8000