azuredocker-composeazure-container-apps

azure Containerapp compose env value


I am trying to deploy multiple containers from docker compose file using az containerapp compose command. It does pick up variable names under environment: in docker-compose.yaml file. But it does not pickup values for these environment variables. I was reading through documentation, here, but haven't found the answer. Is it possible to use .env file? The only workaround I know is to use containerapp native yaml file and set variable value using it. Are the others ways?


Solution

  • The az containerapp compose command does not directly support .env files for populating environment variable values in a docker-compose.yaml file. Would recommend you to switch to native container app yaml i.e. manually pass environment variables via cli, yaml config, or through preprocessing.

    something like this-

    properties:
      containers:
        - name: app
          image: nginx:latest
          env:
            - name: VAR1
              value: value1
            - name: VAR2
              value: value2
    

    Found similar thread1 and thread2 asked on MS QnA forum

    You can also checkout MS Doc