tg123 / Docker-AzureStorageEmulator

Docker Image of AzureStorageEmulator
https://hub.docker.com/r/microsoft/azure-storage-emulator/
MIT License
13 stars 4 forks source link
azure-storage docker emulator

Azure Storage Emulator Docker Image

https://docs.microsoft.com/en-us/azure/storage/storage-use-emulator

Build status

Microsoft Docker hub verison

please use farmer1992/azure-storage-emulator instead of microsoft/azure-storage-emulator MS repo are moving to a new project https://github.com/Azure/Azurite. thus, the old .net version was freezed.

Usage

docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 farmer1992/azure-storage-emulator

You may want C# code to generate connection string

Note: No need to modify the secret, it was hardcoded in container.

Raw string

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;TableEndpoint=http://127.0.0.1:10002/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;

C#

static string GenerateConnStr(string ip = "127.0.0.1", int blobport = 10000, int queueport = 10001, int tableport = 10002)
{
    return $"DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://{ip}:{blobport}/devstoreaccount1;TableEndpoint=http://{ip}:{tableport}/devstoreaccount1;QueueEndpoint=http://{ip}:{queueport}/devstoreaccount1;";
}

Connect to emulator

var cloudStorageAccount = CloudStorageAccount.Parse(GenerateConnStr());

// ...