Web App for Containers: sidecar containers can't see the environment variables

Carol Lai 0 Reputation points
2025-02-26T03:38:13.4466667+00:00

I have a Web App for Containers. I use the Deployment Center on Azure Portal to configure the containers. I use the advanced sidecar container support to add a main container and 2 sidecar containers. All three containers use the same image that is stored in Azure Container Registry.

When I first start this Web App, everything run well. All containers can see the environment variables defined under settings. Then if I stop and restart a few times. The main container still see the environment variables, but the sidecar containers will not be able to see the environment variables anymore.

I'm not sure how to fix this problem.

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

2 answers

Sort by: Most helpful
  1. Deepanshu katara 16,790 Reputation points MVP Moderator
    2025-02-26T05:02:14.8033333+00:00

    Hello Carol, Welcome to MS Q&A

    Sidecar containers in Kubernetes do not automatically inherit environment variables from the main application container, meaning they cannot directly access the environment variables set for the primary container unless explicitly defined in their own configuration; essentially, each container within a pod has its own set of environment variables, even if they share the same network namespace

    Please check this for more details

    Sidecar Containers

    Kindly let me know if have further questions

    Pls accept if it helps

    Thanks

    Deepanshu

    0 comments No comments

  2. Bhargavi Naragani 6,365 Reputation points Microsoft External Staff Moderator
    2025-03-25T18:23:45.59+00:00

    Hi @Carol Lai,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! 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'll repost your solution in case you'd like to accept the answer.

    Issue: Web App for Containers: sidecar containers can't see the environment variables

    Solution:

    The newer version of the advanced sidecar container panel has a flag a shown. Once I checked that flag and all the environment variables that are defined on the Environment Variables panel can be seen in the sidecar containers.
    sidecar


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

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.