Azure SQL Edge Does not persist data to docker volumes

Viewed 662

I'm having troubles persisting database data to docker volume.

I have a docker compose with azure SQL edge container. Here is the configuration for the container:

services:
  azure-sql:
    image: "mcr.microsoft.com/azure-sql-edge"
    hostname: "azure-sql"
    environment:
      ACCEPT_EULA: 1
      MSSQL_SA_PASSWORD: ":8jNZdK7cK"
      MSSQL_USER: "SA"
      MSSQL_PID: "Developer"
    volumes:
      - azure-sql-storage:/var/opt/mssql-extensibility/data
      - azure-sql-storage:/var/opt/mssql-extensibility/log
      - azure-sql-storage:/var/opt/mssql-extensibility
    ports:
      - "1433:1433"

volumes:
  azure-sql-storage:
    external: true

Each time a go "docker-compose down" and then "docker-compose up" containers are dropped and then re-created. I noticed that each time azure SQL runs in a new container it creates new folders in the mapped directories (it uses UUIDs for that) and stores data here.

enter image description here

Is there any chance I can persist data and reuse it even when containers are disposed? May Azure SQL container can be configured so reuse previously created directories instead of creating new?

I tested stand alone container but the result was the same.

Also I noticed that if I stop containers instead of disposing them and re-run them – data is persisted.

1 Answers

Not sure how old that known-issue about using volumes on a Mac is, but I was able to.

volumes:
  - azure-sql-storage:/var/opt/mssql

Got it from here.

Related