如何将Dockerfile中的卷装入Azure存储文件 [英] How to mount a volume in Dockerfile to Azure storage file

查看:73
本文介绍了如何将Dockerfile中的卷装入Azure存储文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在使用Azure进行一个小项目,看看我能用它做些什么。

I'm playing with Azure with a small project to see what can I do with it.

对现在,我已经在dockerhub上创建了一个docker容器的docker实例。它工作得很好,到目前为止我很高兴。但是我找不到在容器中安装Azure存储的最简单且最有效的方法。



我应该在Dockerfile中添加一些内容吗?或者我应该从docker容器的实例的bash运行一些命令?我正在寻找一种方法来为docker实例中上传的文件设置一些持久性。

Right now, I've created a docker instance of a docker container hosted on dockerhub. It works really well and I'm very pleased so far. But I couldn't find the easiest and working way to mount a Azure storage inside my container.

Should I add some things into the Dockerfile ? Or should I run some command from the bash of the instance of the docker container ? I'm looking for a way to set some persistence for files uploaded inside the docker instance.

我想知道如何在我的容器中安装Azure存储文件,所以我不知道不得不担心容器重启(这意味着到目前为止添加的所有文件都丢失了)。我设法将我的计算机上的本地卷安装到我的
容器的本地实例。我想在Azure上做同样的事情。

I would like to know how can I mount an Azure storage file in my container so I don't have to be afraid that the container is rebooted (which means all files added so far are lost). I manage to mount a local volume on my computer to a local instance of my container. I would like to do the same on Azure.

有没有人这样做过?

非常感谢!

推荐答案

使用Azure文件存储的持久Docker卷

docker run -it \
--mount type=volume,volume-driver=cloudstor:azure,target=/data,volume-opt=share=myShare \

OR
docker volume create -d azurefile -o share=myvol --name vol1 

docker run -i -t -v vol1:/data busybox    
In your compose you need to use this skeleton:
volumes:
  myvol:
    driver: azurefile
    driver_opts:
      accountname: ___your__account_name
      accountkey: ___your_account_key
      share: "volumes"
      remotepath: "myvol"

您可以参考此
中提到的说明
链接

其他信息:  Azure文件存储的Docker卷驱动程序

如果上述情况有所帮助,或者您需要有关此问题的进一步帮助,请告诉我们。

这篇关于如何将Dockerfile中的卷装入Azure存储文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆