Azure SQL Edge不会将数据持续到Docker卷
我在将数据库数据持久保存到 docker 卷时遇到问题。
我有一个带有 azure SQL Edge 容器的 docker compose。以下是容器的配置:
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
我注意到每次 azure SQL 重新运行容器时,它都会在映射卷中创建新文件夹,而不是使用旧文件夹并在其中存储数据。
即使容器被废弃,我是否有机会保留数据并重用它?是否可以配置 Azure SQL 容器,以便重用以前创建的目录而不是创建新目录?
我测试了独立容器,但结果是相同的。
我还注意到,如果我停止容器而不是处理它们并重新运行它们 - 数据将被保留。
UPD
看起来这是一个已知问题。 dockerhub 页面上提到了这一点: “在 Docker for Mac 上安装卷不起作用”
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.
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"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定关于在Mac上使用卷的已知年龄是多大的,但是我能够。
从
Not sure how old that known-issue about using volumes on a Mac is, but I was able to.
Got it from here.