Skip to content

Azurite Service

Azurite is a program that allows you to "emulate" Azure Storage Service locally.

See Azurite home page for more details.

This is not intented to be served on a public server, but for inhouse Azure development.

configure your node to support docker-compose

You need to install and configure docker and docker-compose on you node see the docker and docker-compose pages.

TABLES

When writting this file, Azurite v3 (current) does not support TABLE emulation, but Azurite v2 does. Then I've worked on adding v2 support for TABLE emulation beside v3 to have the latest QUEUE and STORAGE services with TABLE too.

docker-compose file

Create a directory where to put all your docker-compose stuff. For instance: /usr/local/services/Azurite/

Create a 'docker-compose.yml' file with this content:

---
version: "3"
services:
  azurite:
    container_name: azurite
    labels:
      EPConnect.net.service: azurite
    logging:
      driver: json-file
    image: mcr.microsoft.com/azure-storage/azurite
    networks:
      - azurite
    ports:
      - 10000:10000  # BLOB service
      - 10001:10001  # QUEUE service
      # Uncomment when TABLE is in v3
      #- 10002:10002  # TABLE service
    volumes:
      - ./Volumes/Azurite-data:/data
    restart: unless-stopped

  # Support TABLE service using V2 version (need to remove as soon as V3 supports it)
  azurite_v2:
    build: 
      context: .
      dockerfile: DockerFile.azurite_v2
    labels:
      EPConnect.net.service: azurite_v2
    logging:
      driver: json-file
    networks:
      - azurite
    ports:
      - 10002:10002  # QUEUE service
    volumes:
      - ./Volumes/Azurite-v2-data/:/opt/azurite/folder
    restart: unless-stopped

networks:
  azurite:
    driver: bridge
Do not forget to change values with your needs.

And create a 'DockerFile.azurite_v2' file with this content:

FROM node:10.6-alpine
# Install GIT
RUN apk --no-cache add git

# Clone Azurite v2
RUN mkdir /opt/azurite -p &&\      
           cd /opt/azurite &&\        
           git clone https://github.com/Azure/Azurite.git .&&\
           git checkout legacy-master

WORKDIR /opt/azurite
RUN npm install

VOLUME /opt/azurite/folder

# Only expose Azure Table Storage Emulator
EXPOSE 10002

# Only run Azurite TABLE service
ENV executable table

CMD ["sh", "-c", "node bin/${executable} -l /opt/azurite/folder"]
Again, do not forget to change values with your needs.

Starting the service

To start the service you have to go in your installation directory: /usr/local/services/Azurite/ Then, as administrator, you will have to run the following command:

docker-compose up --build -d

(for later runs, you can omit the --build options).