问题描述
我花了一些时间来创建有用的Docker卷以供工作使用.它上面有一个我们软件数据库(SQL Server)的还原备份,我通过将它附加到我当时想运行的任何Linux SQL容器上来将其用于测试/调试.
I have taken some time to create a useful Docker volume for use at work. It has a restored backup of one of our software databases (SQL Server) on it, and I use it for testing/debug by just attaching it to whatever Linux SQL Container I feel like running at the time.
当我在工作中制作有用的Docker映像时,我会使用Azure容器注册表或AWS Elastic Container Registry与我们的团队共享它们.如果作为解决方案的一部分我有一个DockerFile,我可以将其存储在我们的GIT存储库中,以供其他人访问.
When I make useful Docker images at work, I share them with our team using either the Azure Container Registry or the AWS Elastic Container Registry. If there's a DockerFile I've made as part of a solution, I can store that in our GIT repo for others to access.
那卷呢?有没有办法与同事共享这些内容,这样他们就不需要经历我最初构建卷所经历的过程了?所以,如果我有这个数据库卷",有没有办法对它进行源代码控制?还是将其作为文件共享给我团队中的其他Docker用户?我只是想为他们节省创建卷的时间,从其存储位置下载.bak文件,进行恢复等.
But what about volumes? Is there a way to share these with colleagues so they don't need to go through the process I went through to build the volume in the first place? So if I've got this 'databasevolume' is there a way to source control it? Or share it as a file to other users of Docker within my team? I'm just looking to save them the time of creating a volume, downloading the .bak file from its storage location, restoring it etc.
推荐答案
简短的答案是,没有默认的Docker功能可导出 docker卷
和 docker export
明确不导出与容器关联的卷的内容.您可以备份,还原或迁移数据卷.
The short answer is that there is no default docker functionality to export the contents of a docker volume
and docker export
explicitly does not export the contents of the volumes associated with the container. You can backup, restore or migrate data volumes.
注意:如果您要备份数据库我建议为此使用适当的工具数据库.
Note: if your're backing up a database I'd suggest using the appropriate tools for that database.
这篇关于在工作场所内共享Docker卷的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!