terça-feira, maio 09, 2023

Deploy multi-container app using Docker Compose

This is a quick post about how to deploy a multi-container app into Azure Container Instances:

    Log in to Azure (I have access to several tenants, so it makes sense to pass the tenant ID as a parameter):

#docker login azure --tenant-id "yourtenant"

    Create a Docker context (select the subscription and resource group):

#docker context create aci mycontext

    If you have more than one context, you can select it using the command below:

#docker context use "yourcontext"

    Check the current context:

#docker context show

    Deploy your Docker Compose:

#docker compose up

Tip:

Below is the code that you must add to your Docker Compose file if you need an external volume (Azure Files). This code mounts a volume on /opt/test.

services:
  myservice:
    container_name: mycontainer
    image: xxxxxx:latest   
    volumes:
      - storagevolume:/opt/test
volumes:
  storagevolume:
    driver: azure_file
    driver_opts:
      share_name: share
      storage_account_name: accountname
      storage_account_key: "XXXXXXXX=="


Nenhum comentário: