Warm tip: This article is reproduced from serverfault.com, please click

Can`t deploy docker-compose infrastructure to Azure Container Instances

发布于 2020-11-28 10:45:54

I am trying to deploy my microservice app to Azure Container Instances. Each service is represented as a Docker image, which is stored in DockerHub. The whole app`s infrastructure is described in the docker-compose.yml file:

version: '3.7'
services:
    db:
        image: darkmode1012/ticketflow_db:1.0.0
        environment:
            - POSTGRES_USER=postgres
            - POSTGRES_DB=postgres
            - POSTGRES_HOST_AUTH_METHOD=trust
        networks:
            - ticketflow-network
        restart: unless-stopped
        ports:
            - 5432:5432

    consul:
        image: "consul:1.8.5"
        networks:
            - ticketflow-network
        ports:
            - "8500:8500"

    identity-service:
        image: darkmode1012/ticketflow_identity-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://identity-service:9001
        restart: unless-stopped

    profile-service:
        image: darkmode1012/ticketflow_profile-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://profile-service:9002
        restart: unless-stopped

    ticket-service:
        image: darkmode1012/ticketflow_ticket-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker
            - ASPNETCORE_URLS=http://ticket-service:9003
        restart: unless-stopped

    movie-service:
        image: darkmode1012/ticketflow_movie-service:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - db
            - consul
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker     
            - ASPNETCORE_URLS=http://movie-service:9004
        restart: unless-stopped            

    api-gateway:
        image: darkmode1012/ticketflow_api-gateway:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - consul
            - identity-service
            - profile-service
            - ticket-service
            - movie-service
        environment:
            - ASPNETCORE_ENVIRONMENT=Docker   
            - ASPNETCORE_URLS=http://host.docker.internal:8080
        restart: unless-stopped        
        ports:
            - "8080:8080"
                    
    web-client:
        image: darkmode1012/ticketflow_web-client:1.0.0
        networks:
            - ticketflow-network
        depends_on:
            - api-gateway
        ports:
            - 3000:3000
        stdin_open: true

networks: 
  ticketflow-network:
    driver: bridge

When I run docker-compose up locally - it works correctly. But when I try to deploy it to Azure Container Instances (following the guideline https://docs.microsoft.com/en-us/azure/container-instances/tutorial-docker-compose), I see the error:

D:\Developing\Ticket_Flow>docker compose up
[+] Running 0/1
 - Group ticket_flow  Waiting                                             92.4s
containerinstance.ContainerGroupsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="ServiceUnavailable" Message="The requested resource is not available in the location 'eastus' at this moment. Please retry with a different resource request or in another location. Resource requested: '9' CPU '8.1' GB memory 'Linux' OS"

I have checked the availability of ACI for the chosen "eastus" region - it is available at the moment. https://status.azure.com/en-us/status?WT.mc_id=A52BDE99C

Also, I have tried to use a resource group with another region - the error remains.

Could you please give me an idea about what can cause this error and how should I fix it?

Questioner
GoodboY
Viewed
11
Charles Xu 2020-11-30 10:20:13

According to my knowledge, the problem is that the resource you require on the CPU for the Azure Container Instance is over the limit of the East US. See the limit here. The max CPU for the East US is 4. But you require 9.

Of course, you can use the maximum allocation to limit the CPU. But I think it's not enough for all of your services. And the ACI is known for its Lightweight. If you need to expose multiple ports to the outside, I recommend you use the AKS to deploy your services, it's more suitable.