Set up Azurite Docker container.

In this post, we will set up docker container for Azurite.

The Azurite open-source emulator provides a free local environment for testing your Azure Blob, Queue Storage, and Table Storage applications. When you’re satisfied with how your application is working locally, switch to using an Azure Storage account in the cloud. The emulator provides cross-platform support on Windows, Linux, and macOS.

We will use docker compose to set up the container. For the sake of this example, we will concentrate on Blobs.

version: '3.4'
services:
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    hostname: azurite
    volumes:
      - ./localstorage/data:/data
    command: "azurite-blob --blobHost 0.0.0.0 -l /data"
    ports:
      - "10000:10000"

While most the instructions are self explanatory, we will concentrate on the command and ports. ‘10000:10000’ will expose the blobs default port. Similarly, if you need to expose the default port of queue, you need to expose 10001 and for Table port 10002.

Furthermore, we have also mapped the /data folder to the ./localstorage/data on local machine.

We are now ready to instantiate our container using the docker compose up command. Once the container is instantiated, we can use the Azure Storage Explorer to connect to the instance.

Right click on Storage accounts and select Connect to Azure Storage

Select Local Storage Emulator.

Complete the details including the port names. That’s all you would require to connect to the blob storage running locally in your development machine

One thought on “Set up Azurite Docker container.

Leave a comment