如何使Azure虚拟机和configuration容器通过docker CLI / quickstartterminal使用Azure文件存储?

我正在使用最新的Docker Toolbox,我想在Azure上启动连接到Azure File Store的docker容器。 从docker快速启动terminal应该运行什么?

最简单的方法是在Azure上预先安装一个预装Docker的Ubuntu VM:

https://azure.microsoft.com/en-us/blog/introducing-docker-in-microsoft-azure-marketplace/

然后按照Azure文件系统Docker卷驱动程序安装说明在这里:

https://github.com/Azure/azurefile-dockervolumedriver/blob/master/contrib/init/systemd/README.md

一旦您可以在该虚拟机上成功创build卷,则可以让它们共享卷或数据卷容器在Docker容器之间共享它们:

https://docs.docker.com/engine/tutorials/dockervolumes/

更多的通用说明,请使用@ rbj325的答案

创builddocker机

首先,我们需要一个我们可以使用的azure色虚拟机。 我们可以使用docker-machine cli来创build这个。 这组指令将使用Ubuntu 16.04LTS创build,以简化(ish)安装步骤。

 docker-machine create --driver azure --azure-subscription-id XXXX \ --azure-location westeurope --azure-resource-group XXX \ --azure-image canonical:UbuntuServer:16.04.0-LTS:latest XXXXXX 

这设置了我们在Azure上所需的一切。

安装azure文件存储docker插件

(根据我对SSH的了解)然后,我们需要SSH进入docker-machine来安装插件。

 docker-machine XXXXXX ssh 

进入后,可以采取以下步骤来安装插件:

 sudo -s wget -qO /usr/bin/azurefile-dockervolumedriver https://github.com/Azure/azurefile-dockervolumedriver/releases/download/[VERSION]/azurefile-dockervolumedriver chmod +x /usr/bin/azurefile-dockervolumedriver wget -qO /etc/systemd/system/azurefile-dockervolumedriver.service https://raw.githubusercontent.com/Azure/azurefile-dockervolumedriver/master/contrib/init/systemd/azurefile-dockervolumedriver.service cp [myconfigfile] /etc/default/ systemctl daemon-reload systemctl enable azurefile-dockervolumedriver systemctl start azurefile-dockervolumedriver systemctl status azurefile-dockervolumedriver 

请注意,这里有需要的东西:

  1. 来自github的驱动程序的最新版本号
  2. 包含一些azure色存储凭证的文件

对于我的安装过程,我制作了一个可以使用的脚本 ,并将我的configuration文件放置在可以在安装时检索的安全存储区中。 请注意,它是获得驱动程序版本0.2.1。

一旦完成,退出ssh连接。

创build卷

您现在应该可以创build泊坞窗卷

 docker volume create --name filestore -d azurefile -o share=filestore 

创builddocker集装箱

您现在可以在docker容器中使用此卷

 docker run -it --name=example -v filestore:/filestore ubuntu /bin/bash