Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure SQL Edge Does not persist data to docker volumes

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

I noticed that each time azure SQL re-runs a container it creates new folders in the mapped volumes instead of using the old ones and stores data there.

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.

UPD

Looks like it's a known issue. It's mention on the dockerhub page: "Mounting a volume does not work on Docker for Mac"

like image 802
Slava Germonenko Avatar asked Nov 21 '25 18:11

Slava Germonenko


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.

like image 102
eShinn Avatar answered Nov 24 '25 07:11

eShinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!