Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container sample doesn't work if run from an ARM device like M1 Macbook #1361

Open
therealjohn opened this issue Nov 13, 2024 · 2 comments
Open

Comments

@therealjohn
Copy link

The docker build command will run on the local machine and produce an ARM build, but when deployed to Azure using the samples, the container app will not be setup correctly and it will fail.

https://github.com/OfficeDev/teams-toolkit-samples/blob/dev/bot-sso-docker/teamsapp.yml#L83

Here's what happens:

After deployment, the bot was not responding, and the Log Stream of the container app didn't show any information. We noticed that the container apps image was still the base hello-world container (mcr.microsoft.com/hello-world) and not bot-sso like defined in the provisioning.

We were able to determine the above by manually changing the Container App image in Azure Portal, which allowed us to identify the error message "Field 'template.containers.bot229004.image' is invalid with details: 'Invalid value: "bot229004.azurecr.io/sso-bot": no child with platform linux/amd64 in index bot229004.azurecr.io/sso-bot';.."

Azure Container Apps does not support arm64 images. As the bot-sso-docker script is building the image on a client workstation running an ARM-based CPU, the final image bot229004.azurecr.io/sso-bot will have an arm64 architecture, which will prevent the Container App from successfully initializing the Revision and switching the image.

To workaround this, we used az acr build --registry ${{AZURE_CONTAINER_REGISTRY_NAME}} --image ${{AZURE_CONTAINER_IMAGE}} ., in order to use Azure Container Registry instead to build a compatible amd64 image.

With this command used instead a compatible image is created and the container app gets setup correctly.

We've raised issues with Azure on why there isn't more helpful error messages or graceful failing in this scenario because the deployment appears to work fine from scripts.

For Teams Toolkit, we need a way to handle building on ARM devices like M1 machines by at least documenting the correct steps in teamsapp.yml. There may be a successful way to use buildx with Docker but we didn't get that working in time.

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

@Yimin-Jin
Copy link
Contributor

Thank you for pointing out the issue. The reason we didn't use the az acr build command in the sso-bot docker sample was that this sample was created before the az acr build feature was available. We have now updated the teamsapp.yml file to use az acr build instead of local builds. The relevant changes have been made in this PR: update docker samples to use az acr build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants