azure-cli-extensions icon indicating copy to clipboard operation
azure-cli-extensions copied to clipboard

Environment vars aren't applied correctly to some containers as stated in docker-compose file

Open vienleidl opened this issue 10 months ago • 3 comments

Describe the bug

The environment vars aren't applied correctly to some containers in the docker-compose file, which is like below: version: '3.4' services: server: image: 'AcrName.azurecr.io/AcrRepoName/server:tag' expose: - 8080 deploy: resources: reservations: cpus: '1' memory: 2gb

spcheck: image: 'AcrName.azurecr.io/AcrRepoName/spcheck:tag' environment: - spcheck.languages=en-US expose: - 8080

php: image: 'AcrName.azurecr.io/AcrRepoName/php:tag' expose: - 8080

customer: image: 'AcrName.azurecr.io/AcrRepoName/customer:tag' expose: - 8080 deploy: resources: reservations: cpus: '1' memory: 2gb

proxy: image: 'AcrName.azurecr.io/AcrRepoName/proxy:tag' expose: - 8080 environment: - FOO=BAR deploy: resources: reservations: cpus: '1' memory: 2gb

scheme: image: 'AcrName.azurecr.io/AcrRepoName/scheme:tag' expose: - 8080

==> The result is that the spcheck's environment variable is not applied to spcheck container app only, but also applied to the php and customer container apps. It has the same issue with the scheme container app is sticked with the proxy's environment variable (FOO=BAR).

Related command

az containerapp compose create -g ResourceGroupName --environment ContainerAppEnvName --location southeastasia --compose-file-path "./docker-compose.yml" --registry-server acrname.azurecr.io --registry-username acrusername--registry-password acrpassword****

Errors

Environment vars are not applied correctly to some containers as stated in docker-compose file.

Issue script & Debug output

cli.azure.cli.core.util: Response content: cli.azure.cli.core.util: {"id":"/subscriptions/subId/resourceGroups/resourceGroupName/providers/Microsoft.App/containerapps/php","name":"php","type":"Microsoft.App/containerApps","location":"West US 2","systemData":{"createdBy":"me","createdByType":"User","createdAt":"2024-04-23T03:43:14.5545272","lastModifiedBy":"her","lastModifiedByType":"User","lastModifiedAt":"2024-04-23T04:09:36.3043964"},"properties":{"provisioningState":"Succeeded","runningStatus":"Running","managedEnvironmentId":"/subscriptions/subId/resourceGroups/resourceGroupName/providers/Microsoft.App/managedEnvironments/containerAppEnvironmentName","environmentId":"/subscriptions/subId/resourceGroups/resourceGroupName/providers/Microsoft.App/managedEnvironments/containerAppEnvironmentName","workloadProfileName":"Consumption","outboundIpAddresses":["0.0.0.0"],"latestRevisionName":"php--replica","latestReadyRevisionName":"php--replica","latestRevisionFqdn":"php--replica.internal.xxx-xxx.westus2.azurecontainerapps.io","customDomainVerificationId":"customDomainVerificationId","configuration":{"secrets":[{"name":"acr-secret"}],"activeRevisionsMode":"Single","ingress":{"fqdn":"php.internal.xxx-xxx.westus2.azurecontainerapps.io","external":false,"targetPort":8080,"exposedPort":0,"transport":"Auto","traffic":[{"weight":100,"latestRevision":true}],"customDomains":null,"allowInsecure":false,"ipSecurityRestrictions":null,"corsPolicy":null,"clientCertificateMode":null,"stickySessions":null,"additionalPortMappings":null,"targetPortHttpScheme":null},"registries":[{"server":"acrName.azurecr.io","username":"acrName","passwordSecretRef":"acrNameazurecrio-acrName","identity":""}],"dapr":null,"maxInactiveRevisions":null,"service":null},"template":{"revisionSuffix":"","terminationGracePeriodSeconds":null,"containers":[{"image":"acrName.azurecr.io/acrrepo/php:tag","name":"php","env":[{"name":"spcheck.languages","value":"en-US"}],"resources":{"cpu":1,"memory":"2Gi","ephemeralStorage":"4Gi"}}],"initContainers":null,"scale":{"minReplicas":null,"maxReplicas":10,"rules":null},"volumes":null,"serviceBinds":null},"eventStreamEndpoint":"https://westus2.azurecontainerapps.dev/subscriptions/subId/resourceGroups/resourceGroupName/containerApps/php/eventstream","delegatedIdentities":[]},"identity":{"type":"None"}} cli.azext_containerapp.containerapp_decorator: Container app created. Access your app at https://php.internal.xxx.xxx.westus2.azurecontainerapps.io/

Expected behavior

Environment variables should be applied correctly to the expected Container Apps, based on the pre-defined docker-compose file.

Environment Summary

azure-cli 2.59.0 core 2.59.0 telemetry 1.1.0

Extensions: aks-preview 3.0.0b5 azure-devops 1.0.0 containerapp 0.3.50

Dependencies: msal 1.27.0 azure-mgmt-resource 23.1.0b2

Additional context

No response

vienleidl avatar Apr 23 '24 04:04 vienleidl

Thank you for opening this issue, we will look into it.

yonzhan avatar Apr 23 '24 04:04 yonzhan

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @calvinsID.

Hi @vienleidl

Thanks for reporting this issue. I will take a look for it.

Greedygre avatar May 09 '24 02:05 Greedygre

Hi @vienleidl

Thanks for reporting this issue. I will take a look for it.

Hi @Greedygre , i've just found that the scheme container app also inherits the specs of CPU and Memory from proxy

deploy:
      resources:
        reservations:
          cpus: '1.0'
          memory: 2gb

vienleidl avatar May 21 '24 03:05 vienleidl

Hi @vienleidl Thanks for reporting this issue. I will take a look for it.

Hi @Greedygre , i've just found that the scheme container app also inherits the specs of CPU and Memory from proxy

deploy:
      resources:
        reservations:
          cpus: '1.0'
          memory: 2gb

Hi @vienleidl This also has been fixed with PR https://github.com/Azure/azure-cli/pull/28922 This fix will be included in version 2.61.0 of azure-cli.

Greedygre avatar May 21 '24 03:05 Greedygre

Hi @vienleidl Thanks for reporting this issue. I will take a look for it.

Hi @Greedygre , i've just found that the scheme container app also inherits the specs of CPU and Memory from proxy

deploy:
      resources:
        reservations:
          cpus: '1.0'
          memory: 2gb

Hi @vienleidl This also has been fixed with PR Azure/azure-cli#28922 This fix will be included in version 2.61.0 of azure-cli.

Awesome & thank you so much!

vienleidl avatar May 24 '24 02:05 vienleidl