I am new to both docker and azure container services. I am trying to deploy a docker web app in the Azure Web App for Containers as single container instance. I am using the azure-vote-front image provided here. I followed the steps provided here after tagging and pushing the docker image in an Azure container register.
But after deploying the web app and navigating to the web url, all it shows is 502 Bad Gateway with nginx/1.15.8 mentioned below. Is there addtional configuration, I need to mention in any file or configure anywhere?
For your issue, you misunderstand the image azure-vote-front
. You can the docker-compose.yaml file in the Github link your provide, it creates the azure-vote-front
image, but it also needs the database Redis. So it's not a single container instance, it's the multiple containers.
You can need to create the image azure-vote-front
and push it to the Azure Container Registry. Also does the image Redis
. Then you can change the docker-compose.yaml
file like this:
version: '3.7'
services:
azure-vote-back:
image: youracrname.azurecr.io/redis
container_name: azure-vote-back
ports:
- "6379:6379"
azure-vote-front:
image: youracrname.azurecr.io/azure-vote-front
container_name: azure-vote-front
environment:
REDIS: azure-vote-back
ports:
- "80:80"
And set the ACR credential with the command here:
az webapp config container set -g group_name -n app_name --docker-registry-server-url youracrname.azurecr.io --docker-registry-server-user acr_username --docker-registry-server-password acr_password
Finally, wait for munites and then you can access the Web App. For more details, see the example Create a multi-container (preview) app in Web App for Containers.