"ACI integration does not support labels in compose applications"但我没有指定任何服务标签



因此,我正试图将一组组合的映像(一个是本地映像,正在构建中,另一个是从我控制的容器注册表中拉入(部署到Azure上的docker容器实例。

我使用docker登录azure,将容器组设置为我的上下文,然后运行

docker compose --env-file ./config/compose/.env.local up

我的docker撰写文件看起来像这个

# version: "3.9"  # optional since v1.27.0
services:
consumer:
build:
context: .
args:
PORTS: 2222 8080 9229
ENVNAME: $ENVNAME
BASEIMAGE: $BASEIMAGE
ports:
- "8080:8080"
image: th3docker.azurecr.io/<imagename>
producer:
image: th3docker.azurecr.io/<imagename>:latest
ports: 
- "5001:5001"
container_name: jobmanager
environment:
- ASPNETCORE_ENVIRONMENT=$ASPNET_ENV
depends_on:
- consumer

查看docker文档,labels似乎在每个服务下都有自己的字段,但我在这个文件中没有。我试着从这个文件中删除容器名称,并尽可能多地删除,但我不明白为什么会出现这个错误。

我看了一下docker compose源代码,这似乎是源代码行91中令人反感的if语句。

for _, s := range project.Services {
service := serviceConfigAciHelper(s)
containerDefinition, err := service.getAciContainer()
...
if service.Labels != nil && len(service.Labels) > 0 {
return containerinstance.ContainerGroup{}, errors.New("ACI integration does not support labels in compose applications")
}
...
}

我似乎仍然没有定义任何标签,除非其他字段被隐式地用作标签。任何关于这里发生了什么或绕过这个问题的替代途径的想法都将不胜感激。

这似乎与使用--env-file有关。https://github.com/docker/compose-cli/issues/2167.

我知道的唯一解决方法是通过命令行逐个导出所有变量,或者使用以下方法:export $(cat docker/.env | xargs) && docker compose up,它将导出所有变量
请确保从.env文件中删除任何#注释,因为导出将失败,否则

最新更新