[英].env file is ignored and not “sourced” by `docker-compose`
Case: I start a service in docker-compose
.案例:我在
docker-compose
启动了一个服务。 All the variables in the .env
file are ignored and not dynamically replaced, such as below: .env
文件中的所有变量.env
被忽略,不会被动态替换,如下所示:
PS C:\workarea\jonathan\myProject> docker-compose up -d myService
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_USER variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_PASSWORD variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The YYYY_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The ZZZ_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_USER variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The XXXXX_PASSWORD variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The YYYY_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The ZZZ_URL variable is not set. Defaulting to a blank string."
time="2021-07-23T15:20:50-04:00" level=warning msg="The DDDDD_ROOT_PASSWORD variable is not set. Defaulting to a blank string."
...
Environment:环境:
The solution consists in disabling Use Docker Compose V2
in Settings > Experimental Features, then "Apply and Restart":解决方案包括在设置 > 实验功能中禁用
Use Docker Compose V2
,然后“应用并重新启动”:
Warning: although this option is unchecked, Docker happens to re-enable it without any user's action.警告:尽管未选中此选项,但 Docker 会在没有任何用户操作的情况下重新启用它。 This occurred to me several times, on two different laptops.
我在两台不同的笔记本电脑上多次出现这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.