Running Azure Blob Storage Locally with Docker

Simulate Azure Blob Storage in your local environment using Azurite

Posted by Hüseyin Sekmenoğlu on April 05, 2023 Cloud Platforms

Testing Azure Blob Storage integration in a local environment can be challenging without the right tools. Fortunately, Microsoft provides Azurite, a lightweight emulator that mimics the Azure Blob, Queue and Table Storage services. This article explains how to run Azure Blob Storage locally using Docker and interact with it just like the real cloud service.


🔧 What Is Azurite?

Azurite is the official emulator by Microsoft for Azure Storage. It is ideal for local development and testing purposes. With Azurite, you can emulate:

  • Blob Storage

  • Queue Storage

  • Table Storage

It’s fast, easy to use and works seamlessly with tools like Azure Storage Explorer and the Azure SDKs.


🐋 Step 1: Pull the Azurite Docker Image

Start by pulling the latest Azurite image from Microsoft’s container registry:

docker pull mcr.microsoft.com/azure-storage/azurite

This will download the image required to simulate Azure Storage locally.


🚀 Step 2: Run Azurite Container

Run Azurite in a Docker container with port mapping for Blob Storage:

docker run -p 10000:10000 mcr.microsoft.com/azure-storage/azurite

This command starts Azurite and maps port 10000 for Blob service access. If you also need Queue and Table Storage, map ports 10001 and 10002 respectively.


🔗 Step 3: Connect to Local Blob Storage

Once the emulator is running, use the following connection string in your application:

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFe5YOJoMGvGb+GGxSDF7xq3c6VBqIMgkW1Ynq6g==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;

Blob Endpoint:

http://127.0.0.1:10000/devstoreaccount1

This allows your local application to interact with Azurite exactly like it would with the real Azure Blob Storage.


🧪 Optional: Use Azure Storage Explorer

For a visual experience, you can inspect your local blobs using Azure Storage Explorer:

  1. Download Azure Storage Explorer

  2. Select Attach to a local emulator

  3. Use the default account name (devstoreaccount1) and key

  4. Set the blob endpoint to http://127.0.0.1:10000/devstoreaccount1

This lets you view containers and blob contents, upload files and perform operations interactively.


🧱 Optional: Use Docker Compose

To integrate Azurite into a Docker Compose setup, add the following service definition:

version: '3.8'
services:
  azurite:
    image: mcr.microsoft.com/azure-storage/azurite
    ports:
      - "10000:10000"
    command: "azurite-blob --blobHost 0.0.0.0"

Now Azurite will run alongside your other services, making it easier to simulate storage interactions in full-stack applications.


✅ Conclusion

Azurite provides a simple and effective way to develop and test Azure Blob Storage features without needing access to the actual cloud. By running it inside Docker, you can easily spin up a local environment that mirrors the production setup, saving time and money during development.

Whether you're building microservices or cloud-based tools, local Azure Blob emulation is now just one Docker command away.