New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web App with custom docker image in azure container registry - environment variables #8423
Comments
@timmydo Thanks for the feedback. We are actively investigating and will get back to you soon. |
Hey @timmydo - I will look into this today and share any relevant findings. Just to clarify, are you not setting environment variables in your Setting environment variables in your container instances |
Thanks for the links. I think they may be more geared towards running containers independently. In my scenario, I'm running a container inside the web app service, so I can't use some of those commands. (I'm guessing the web app service starts my container and forwards http requests to port 80 on it) I'm not setting env vars in my dockerfile because my dockerfile is checked into a public git repository and I don't want to put secrets there. I suppose I could work around it by creating another secret dockerfile with environment variables, but it would be more convenient to put it into the azure portal (maybe in the azure web app application settings section?). |
@timmydo Yup, definitely not ideal when on a public repo. So the configuration values (key, value pairs) defined through app settings are made available to your application at its runtime as With that said, check out the following doc where it discusses defining a custom deployment (build process) with VSTS to Web App for Containers: Why use a separate release definition instead of the automatic deployment feature available in Web App for Containers? |
That doc links to a doc telling you how to build a container using VSTS, but that doc explaining how to build a container with a VSTS step doesn't mention anything about handling secrets/environment variables. The VSTS task to build a docker image requires a dockerfile that's checked into the repository. I could have an inline powershell script generate a dockerfile somewhere before running the docker build step, but it seems like a hack. I think this is mostly docker's fault Maybe an alternative is to use a kubernetes pod yaml definition in the web app in the azure portal to define the environment variables, but I can't find any good docs on that. It doesn't seem like the right place to put config since I think those pod definitions make more sense checked into source control. Who would be the right person to make a feature request to allow passing of env vars to the docker run command in the azure portal? |
@neilpeterson would happen to have any insights into this? I know it is technically a web-app doc but it is in regards to containers so thought it might be worth an ask |
I've not worked with web-apps myself, however quick scan of the doc shows that we can used
Looking at the portal, I do not see a very straight forward way of accomplishing this. As @timmydo has pointed out, looks like we can consume a Docker Compose or Kubernetes manifest file, which should both do the trick. So a compose file like this should work (I've confirmed).
That said, I would also expect something more basic, similar to the @SyntaxC4 and thoughts on this one? |
@timmydo we solved this using the azure cli to set our Application Setting variables. All those variables end up in the environment of the launched docker cmd/entrypoint. e.g So at least they aren't in source control. |
@saschwarz I don't think azure application settings are passed to |
@timmydo Maybe we are talking about different ways to run docker containers in Azure? In WebApps for Containers I don't issue |
@timmydo Please submit a feature request at Azure Feedback site so that the community can upvote this feature & our product team can review for future implementation. We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion. |
This topic is exactly what I was/am searching for days. In the end I put a question on stackoverflow (https://stackoverflow.com/questions/50681821/deploy-azure-webapp-with-custom-container-environment-variables) in order to get an answer to my question. |
Same question here. For now, I just want to say: stupid azure! |
Hi everyone, Any workaround on this topic ?, we are facing the same issue in 2019 while trying to pass environment variables (parameters) to my private docker image through an App Service, Web App for Container or simple Containers in Azure... it is always the same failing output |
Use application settings under the configuration tab in sectuon settings in app service. Every application setting is passed to the container as an env variable. |
We are still seeing an issue where our .nercore app within a container that being pulled from ACR is not picking up the app settings from the App Service within the Azure portal. The values are not automatically being injected at run time as the documentation suggests. |
I feel like being able to add environment variables to the I am not surprised that again Azure manages to turn something trivial into an issue which takes me way too long to fix. |
We are using applications settings to inject variables to custom docker images and docker compose apps for 5 months now without any issue... |
When I tail the
It seems like the environment variables are injected when the entrypoint is ran though, but afterwards they're not accessible anymore. Highly annoying. |
Having the same issue after a deployment and can't get it back online. production has been down for 5 hours |
I am facing the same issue. If this is resolved, pls let me know the steps. |
I'm having a hard time finding where I can set custom environment variables that docker run will pass to my custom docker image. My image reads config from those environment variables.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: