Ross Vernal
Ross Vernal

Reputation: 493

Deploying via Docker Compose to Azure App Service with multiple containers from different sources

I have a docker-compose.yml file which is created from a build step in Azure Devops. The build step works well and I can see how the docker-compose.yml file is produced. That makes sense to me.

However, it is looking for a normal docker image to run one of the services and the other service is one I've created and am hosting in my Azure Container Registry.

The docker compose file looks like this:

networks:
    my-network:
        external: true
name: my-network

services:
    clamav:
        image: mkodockx/docker-clamav@sha256:b90929eebf08b6c3c0e2104f3f6d558549612611f0be82c2c9b107f01c62a759
        networks:
            my-network: {}
        ports:
            - published: 3310
              target: 3310
    super-duper-service:
        build:
        context: .
        dockerfile: super-duper-service/Dockerfile
        image: xxxxxx.azurecr.io/superduperservice@sha256:ec3dd010ea02025c23b336dc7abeee17725a3b219e303d73768c2145de710432
        networks:
            my-network: {}
        ports:
            - published: 80
              target: 80
            - published: 443
              target: 443
version: '3.4'

When I put this into an Azure App Service using the Docker Compose tab, I have to select an image tab - either Azure Container Registry or Docker Hub - I'm guessing the former because I am connected to that.

When I start the service, my logs say:

2020-12-04T14:11:38.175Z ERROR - Start multi-container app failed
2020-12-04T14:23:28.531Z INFO - Starting multi-container app..
2020-12-04T14:23:28.531Z ERROR - Exception in multi-container config parsing: Exception: System.NullReferenceException, Msg: Object reference not set to an instance of an object.
2020-12-04T14:23:28.532Z ERROR - Start multi-container app failed
2020-12-04T14:23:28.534Z INFO - Stopping site ingeniuus-antivirus because it failed during startup.

It's not very helpful, and I don't think there's anything wrong with that docker-compose.yml file.

If I try to deploy ONLY the service from the Azure Container registry, it deploys, but doesn't deploy the other service.

Does anyone know why the service doesn't start?

Upvotes: 1

Views: 2805

Answers (1)

Charles Xu
Charles Xu

Reputation: 31462

Well, there are two problems I find in your docker-compose file for the Azure Web App.

One problem is that Azure Web App only supports configuring one image repository in the docker-compose file. It means you only can configure the Docker Hub or ACR, not both.

Another problem is that Azure Web App does not support the build option in the docker-compose file. See the details here.

According to all the above, I suggest you can create all your custom images and push them to the ACR and use the ACR only.

Upvotes: 2

Related Questions