Reputation: 824
We have an azure infra with vnet.
We have a gradel app and a dockerfile that looks like this:
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo "source /opt/miniconda/etc/profile.d/conda.sh && \
conda activate" >> ~/.bashrc
COPY logic/ /app/logic
COPY assets/ /app/assets
COPY utils/ /app/utils
COPY python_specs/sss_env.yml /app
COPY app.py /app
WORKDIR /app
RUN source /opt/miniconda/etc/profile.d/conda.sh && \
conda activate && \
conda install conda && \
pip install cmake && \
conda env update -f sss_env.yml
EXPOSE 8080
# conda:
CMD ["conda", "run", "--no-capture-output", "-n", "sss-env", "python", "-m", "app", "--port", "8081"]
The docker file builts and runs normally on the local instance (compute/machine). The devops pipeline build and push docker image fine, and nother pipeline deploys the web app using the container:
All looks fine until we try to see the log steam of the web app. In there, all seems fine except this line:
2024-11-27T09:10:07.6520207Z ERROR conda.cli.main_run:execute(125):
conda run python -m app --port 8081
failed. (See above for error)/home/LogFiles/2024_11_27_lw0sdlwk0006T6_default_scm_docker.log (https://somename-dev.scm.azurewebsites.net/api/vfs/LogFiles/2024_11_27_lw0sdlwk0006T6_default_scm_docker.log)
We have added the WEBSITE_PORT: 8081 to the Environemnt variables in the web app service:
I am unable to get to the reason why this docker command fails, have looked everywhere.
Would be thankful if someone can help!
P.s The docker is build and pushed to vnet integrated acr using a normal ubuntu-latest agent The web app is deployed using a self-hosted agent.
The command: RUN conda env list && conda list -n sss-env gives
# conda environments:
#
base * /opt/miniconda
abs-env /opt/miniconda/envs/abs-env
# packages in environment at /opt/miniconda/envs/abs-env:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
aiofiles 23.2.1 pypi_0 pypi
annotated-types 0.7.0 pypi_0 pypi
anyio 4.6.2.post1 pypi_0 pypi
bzip2 1.0.8 h4bc722e_7 conda-forge
ca-certificates 2024.8.30 hbcca054_0 conda-forge
certifi 2024.8.30 pypi_0 pypi
charset-normalizer 3.4.0 pypi_0 pypi
click 8.1.7 pypi_0 pypi
contourpy 1.3.1 pypi_0 pypi
cycler 0.12.1 pypi_0 pypi
et-xmlfile 2.0.0 pypi_0 pypi
exceptiongroup 1.2.2 pypi_0 pypi
faiss 1.7.2 py310hd7ef7d9_4_cpu conda-forge
faiss-cpu 1.7.2 h718b53a_4 conda-forge
fastapi 0.115.5 pypi_0 pypi
ffmpy 0.4.0 pypi_0 pypi
filelock 3.16.1 pypi_0 pypi
fonttools 4.55.0 pypi_0 pypi
fsspec 2024.10.0 pypi_0 pypi
gradio 5.1.0 pypi_0 pypi
gradio-client 1.4.0 pypi_0 pypi
h11 0.14.0 pypi_0 pypi
httpcore 1.0.7 pypi_0 pypi
httpx 0.27.2 pypi_0 pypi
huggingface-hub 0.26.2 pypi_0 pypi
idna 3.10 pypi_0 pypi
intel-openmp 2022.0.1 h06a4308_3633
jinja2 3.1.4 pypi_0 pypi
joblib 1.4.2 pypi_0 pypi
kiwisolver 1.4.7 pypi_0 pypi
ld_impl_linux-64 2.43 h712a8e2_2 conda-forge
libblas 3.9.0 25_linux64_openblas conda-forge
libcblas 3.9.0 25_linux64_openblas conda-forge
libfaiss 1.7.2 h2bc3f7f_0_cpu pytorch
libfaiss-avx2 1.7.2 h1234567_4_cpu conda-forge
libffi 3.4.2 h7f98852_5 conda-forge
libgcc 14.2.0 h77fa898_1 conda-forge
libgcc-ng 14.2.0 h69a702a_1 conda-forge
libgfortran 14.2.0 h69a702a_1 conda-forge
libgfortran5 14.2.0 hd5240d6_1 conda-forge
libgomp 14.2.0 h77fa898_1 conda-forge
liblapack 3.9.0 25_linux64_openblas conda-forge
libnsl 2.0.1 hd590300_0 conda-forge
libopenblas 0.3.28 pthreads_h94d23a6_1 conda-forge
libsqlite 3.47.0 hadc24fc_1 conda-forge
libstdcxx 14.2.0 hc0a3c3a_1 conda-forge
libstdcxx-ng 14.2.0 h4852527_1 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libxcrypt 4.4.36 hd590300_1 conda-forge
libzlib 1.3.1 hb9d3cd8_2 conda-forge
markdown-it-py 3.0.0 pypi_0 pypi
markupsafe 2.1.5 pypi_0 pypi
matplotlib 3.7.1 pypi_0 pypi
mdurl 0.1.2 pypi_0 pypi
mkl 2022.1.0 hc2b9512_224
ncurses 6.5 he02047a_1 conda-forge
numpy 1.26.4 py310hb13e2d6_0 conda-forge
openpyxl 3.1.5 pypi_0 pypi
openssl 3.4.0 hb9d3cd8_0 conda-forge
orjson 3.10.12 pypi_0 pypi
packaging 24.2 pypi_0 pypi
pandas 2.0.0 pypi_0 pypi
pillow 10.4.0 pypi_0 pypi
pip 22.3.1 pyhd8ed1ab_0 conda-forge
pydantic 2.10.1 pypi_0 pypi
pydantic-core 2.27.1 pypi_0 pypi
pydub 0.25.1 pypi_0 pypi
pygments 2.18.0 pypi_0 pypi
pyparsing 3.2.0 pypi_0 pypi
python 3.10.15 h4a871b0_2_cpython conda-forge
python-dateutil 2.9.0.post0 pypi_0 pypi
python-multipart 0.0.17 pypi_0 pypi
python_abi 3.10 5_cp310 conda-forge
pytz 2024.2 pypi_0 pypi
pyyaml 6.0.2 pypi_0 pypi
readline 8.2 h8228510_1 conda-forge
requests 2.32.3 pypi_0 pypi
rich 13.9.4 pypi_0 pypi
ruff 0.8.0 pypi_0 pypi
scikit-learn 1.5.2 pypi_0 pypi
scipy 1.14.1 pypi_0 pypi
seaborn 0.12.2 pypi_0 pypi
semantic-version 2.10.0 pypi_0 pypi
setuptools 75.6.0 pyhff2d567_0 conda-forge
shellingham 1.5.4 pypi_0 pypi
six 1.16.0 pypi_0 pypi
sniffio 1.3.1 pypi_0 pypi
starlette 0.41.3 pypi_0 pypi
stringcase 1.2.0 pypi_0 pypi
threadpoolctl 3.5.0 pypi_0 pypi
tk 8.6.13 noxft_h4845f30_101 conda-forge
tomlkit 0.12.0 pypi_0 pypi
tqdm 4.67.1 pypi_0 pypi
typer 0.13.1 pypi_0 pypi
typing-extensions 4.12.2 pypi_0 pypi
tzdata 2024.2 pypi_0 pypi
urllib3 2.2.3 pypi_0 pypi
uvicorn 0.32.1 pypi_0 pypi
websockets 12.0 pypi_0 pypi
wheel 0.45.1 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h166bdaf_0 conda-forge
gives this:
Upvotes: 0
Views: 70
Reputation: 3415
The logs indicate that the app is listening on 0.0.0.0:8181
instead of 8081
. This is likely the root cause of the issue where Azure expects the app to listen on the port defined by WEBSITE_PORT
(which is set to 8081
).
The App should bind to port 8081
, especially when running inside Azure. You are using conda run
to start the app, you may need to explicitly pass the correct port to the application with in the Py code, especially if it's using a framework like FastAPI or Flask.
Set the WEBSITE_PORT
environment variable correctly in the Azure Web App and exposed it in the Dockerfile.
Check the CMD
statement below:
CMD ["bash", "-c", "conda run --no-capture-output -n abs-env python -m app --port $WEBSITE_PORT"]
chmod: changing permissions of '/temp': Operation not ..some confiurations
/temp
to /tmp
. This is a common location for temporary files in Linux-based systems.Updated Dockerfile:
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo "source /opt/miniconda/etc/profile.d/conda.sh && \
conda activate" >> ~/.bashrc
COPY logic/ /app/logic
COPY assets/ /app/assets
COPY utils/ /app/utils
COPY python_specs/sss_env.yml /app
COPY app.py /app
WORKDIR /app
# Install dependencies and validate environment
RUN source /opt/miniconda/etc/profile.d/conda.sh && \
conda install conda && \
pip install cmake && \
conda env update -f sss_env.yml && \
conda env list
EXPOSE 8081
# Ensure the app uses the correct port from the environment variable
CMD ["conda", "run", "--no-capture-output", "-n", "abs-env", "python", "-m", "app", "--port", "8081"]
Upvotes: 0