首页 > 其他 > 详细

Docker Run 设置环境变量

时间:2019-04-11 11:08:20      阅读:267      评论:0      收藏:0      [点我收藏+]

Docker Run

We can then override the environment variables set in the Docker file when running the image by using the -e flag:

Docker run -e "EmailServer=192.168.0.1" myimage

 

对应.netcore应用程序,设置 ASPNETCORE_ENVIRONMENT 环境变量为自定义的值,就会寻找对应的配置文件,默认不设置会加载appsettings.json

Docker run -e "ASPNETCORE_ENVIRONMENT=development" myimage

参考:

https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/environments?view=aspnetcore-2.2

https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/host/web-host?view=aspnetcore-2.2#set-up-a-host

https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/index?view=aspnetcore-2.2#json-configuration-provider

https://www.scottbrady91.com/Docker/ASPNET-Core-and-Docker-Environment-Variables

https://andrewlock.net/how-to-set-the-hosting-environment-in-asp-net-core/

http://www.cnblogs.com/dudu/p/6985313.html

 

Docker Run 设置环境变量

原文:https://www.cnblogs.com/lishidefengchen/p/10688259.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!