2

So I'm trying to deploy a composed set of images, (one is local and is being built the other is being pulled in from a container registry I control) to a docker container instance on Azure.

I login to azure with docker, set the container group as my context then run

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

My docker compose file looks like this

# 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

Looking at the docker documentation, labels seem to be a field of its own under each service, but I don't have any in this file. I've tried removing container names, and as much as I can from this file but I just don't understand why I'm getting this error.

I took a look at the docker compose source code and this seems to be the offending if statement in the source line 91.

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")
        }
    ...
    }

Still seems like I am not defining any labels unless some other field is implicitly being consumed as a label. Any idea what's going on here or alternate path to get around this issue would be appreciated.

Josh Bell
  • 31
  • 1
  • 5

1 Answers1

1

It seems to be related to using --env-file. https://github.com/docker/compose-cli/issues/2167.

The only workaround I know is to either export all variables through the command line one by one, or to use this: export $(cat docker/.env | xargs) && docker compose up which will export all variables.
Be sure to remove any # comments from the .env file as export will fail otherwise

Lao
  • 55
  • 1
  • 7
  • Just trying to help :), but point taken. I'll try to improve it so it's an answer, as I think I've found a workaround – Lao Sep 30 '22 at 10:43