Azure / Azure/azure-cli

[Reference feedback]: Please include more info on topics such as port mapping, accessing secrets, and using volumes.

Open
#32,593 6 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Auto-Assign ContainerApp customer-reported Documentation needs-triage question Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Type of issue

Missing information

### Reference command name

`az containerapp compose create`

### Feedback

There are a few features of docker-compose that I use for local runs that don't seem to map directly when I use `az containerapp compose create`.

I am using the following bash script for my build:

```bash
export LOCATION=eastus2
export RESOURCE_GROUP=rg-my-project
export ENV_NAME=env-my-project

az group create --name $RESOURCE_GROUP --location $LOCATION &&

az containerapp env create \
--name $ENV_NAME \
--resource-group $RESOURCE_GROUP \
--location $LOCATION &&

az containerapp compose create -g $RESOURCE_GROUP \
--environment $ENV_NAME
```

And my docker-compose looks something like this (I have removed sensitive info specific to my project):

```yaml
name: my-project
services:

# A dependency service that I pull from a container registry
dependency-project:
restart: always
build:
context: ./stable
tags:
- "someurl.com/dependency-project:stable"
image: someurl.com/dependency-project:stable
env_file:
- .env
ports:
- "127.0.0.1:4001:4003"
- "127.0.0.1:4002:4004"
- "127.0.0.1:5900:5900"

# My locally-built service
my-project-service:
build: .
env_file:
- .env
stdin_open: true
tty: true
ports:
- "127.0.0.1:5001:5001"
volumes:
# This ties the container to the host timezone
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
# Logging direcotory
- ./logs:/app/logs
```

I am having issues with the following features:

## Port mapping

As you can see from my docker-compose file, I map multiple ports for one of the containers. `az containerapp compose create` makes me pick one when I run the command.

## Volume Mounts

I map a log directory in my docker-compose. I assume I will have to configure some kind of Azure resource for volume mounting, but the documentation does not cover this.

## Secret Environment Variables

My .env file will contain some sensitive info, which I will need to store in an Azure Key Vault. The documentation does not describe how to reference this in the docker-compose file.

### Page URL

https://learn.microsoft.com/en-us/cli/azure/containerapp/compose?view=azure-cli-latest#az-containerapp-compose-create

### Content source URL

https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/docs-ref-autogen/Latest-version/latest/containerapp/compose.yml

### Author

@mikefrobbins

### Document Id

d10250cd-c6ca-a9a6-d6e8-b93f81b94ff1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.