Christopher Maneu
Christopher Maneu
Azure Engineer & Developer Advocate at Microsoft.
Dec 9, 2019 1 min reading

#Tip Use local Azure Storage emulator in Remote Containers

thumbnail for this post

I LOVE Remote Development Extensions for Visual Studio Code. It allows me to simply pack all my technical stack in one docker container, while getting me everything I need to run and debug things.

Everything, this includes localhost, right?

Ehmm.. that depends! This morning, I was doing different things with Azure Functions SDK for 25 days of serverless, and for that I needed to access the local Azure Storage Emulator, the one on my local machine - not within a Docker container.

How can I possibly access local resources - who are neither on Internet or within another container - from a container?

3 magic words

host.docker.internal. That's all you need within your container to access your “real” localhost, and everything hosted on it. Like my Azure Storage Emulator :). With that bit of magic, I was able to replace the usuel local connection string UseDevelopmentStorage=true; by the following :

UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://host.docker.internal

Et voilà! I'm now able to use the benefits of Remote Containers development while using all my local hosted tools, including the Azure Storage Emulator :)