I got answer on Reddit faster that's right
I add the below line in start.sh and it worked thanks to tehho1337
printenv > .env
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I deployed a azure app service in container mode the environment variables are not being passed to the container in runtime.
when I use print env I don't see them
0437a64035034116b857b570415484fa:~# printenv
MAIL=/var/mail/root
USER=root
SSH_CLIENT=169.254.130.5 58518 2222
SHLVL=1
HOME=/root
SSH_TTY=/dev/pts/0
PAGER=less
LOGNAME=root
TERM=xterm-color
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=C.UTF-8
SHELL=/bin/ash
PWD=/root
SSH_CONNECTION=169.254.130.5 58518 169.254.130.4 2222
CHARSET=UTF-8
I tried ticking and removing the environment deployment slot settings
Here is my Dockerfile
FROM python:3.11-alpine3.19 as build
COPY ./requirements.txt ./
RUN pip3 install --no-cache-dir -r ./requirements.txt
FROM python:3.11-alpine3.19 as final
COPY sshd_config /etc/ssh/
RUN apk update \
&& apk upgrade \
&& apk add openssh \
&& echo "root:Docker!" | chpasswd \
&& cd /etc/ssh/ \
&& ssh-keygen -A
WORKDIR /app/
COPY ./ ./
COPY --from=build /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
EXPOSE 80/tcp 2222
ENTRYPOINT ["./start.sh"]
I want the environment variables in docker container.
I got answer on Reddit faster that's right
I add the below line in start.sh and it worked thanks to tehho1337
printenv > .env
@HARSHA VARDHAN V , Glad to see that your issue is resolved and thanks for confirming the solution that worked. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, I' have summarized and posted the solution ( shared by you), request you to Accept the answer, it will benefit the community find the answers quickly.
Scenario:
Environment Variables Not Passed to Azure Container App Service in Runtime
Issue:
Upon deploying an Azure App Service in container mode, environment variables are not being passed to the container during runtime, as evidenced by the absence of environment variables when checking with 'printenv' command inside the container.
Resolution:
@HARSHA VARDHAN V confirmed the solution, answered shared by tehho1337 on reddit forum thread.
To resolve the issue, the following line was added to the 'start.sh' script:
printenv > .env
--Please click Accept Answer- it will benefit the community to find the answers quickly.