Reputation:
I want to deploy a containerized Web-App to MS Azure. Therefore I've written the following docker-compose file:
version: "3"
services:
frontend:
image: fitnessappcontainerregistry.azurecr.io/crushit:frontend
build:
context: ./frontend
dockerfile: Dockerfile
networks:
- crushit
ports:
- "80:3000"
restart: unless-stopped
wikihow:
image: fitnessappcontainerregistry.azurecr.io/crushit:backend-wikihow
build:
context: ./backend
dockerfile: ./services/WikiHow Service/Dockerfile
networks:
- crushit
restart: unless-stopped
training:
image: fitnessappcontainerregistry.azurecr.io/crushit:backend-training
build:
context: ./backend
dockerfile: ./services/Training Service/Dockerfile
networks:
- crushit
restart: unless-stopped
eventpublisher:
image: fitnessappcontainerregistry.azurecr.io/crushit:backend-eventpublisher
build:
context: ./backend
dockerfile: ./services/EventPublisher/Dockerfile
networks:
- crushit
restart: unless-stopped
accountservice:
image: fitnessappcontainerregistry.azurecr.io/crushit:backend-account
build:
context: ./backend
dockerfile: ./services/Account Service/Dockerfile
networks:
- crushit
restart: unless-stopped
proxy:
image: fitnessappcontainerregistry.azurecr.io/crushit:backend-proxy
build:
context: ./backend
dockerfile: ./proxy/Dockerfile
networks:
- crushit
ports:
- "5000:5000"
restart: unless-stopped
networks:
crushit:
driver: bridge
For the App to function, two Containers (frontend, proxy) have to be exposed to the outside. Additionally all Containers have to be able to communicate with each other (therefore I added a custom network to all services). All Container-Images are stored in an Azure Container Registry. Now I'm wondering how I can host my App on Azure. I already tried "Web App for Containers" which is the same as "App Services" I think. That didn't work fully, as I was not able to expose a "non standard" Port like 5000. Is there any other way to host my App on Azure using this docker-compose file, or do I have to use Kubernetes instead?
Upvotes: 1
Views: 2030
Reputation: 31452
You can use the docker-compose.yml file to deploy containers in the Azure Web App for container. And there is something you need to know.
First, the Azure Web App only can expose one port to the outside. So it means you can only expose one container to the outside, not two.
Second, if you expose a port other than 80 or 443, then you can use the environment variable WEBSITES_PORT
to let Azure know. Here is the documentation.
Third, the Web App only supports a part of the options of the docker-compose, here you can see the supported options and the unsupported options.
The last one is that all the containers in the Web App can communicate with each other via the port that the container exposes. So you don't need to set the network
option.
Upvotes: 0