[英]How to mount Azure File Share as Volume for Container Group using docker-compose?
I want to mount Azure File Share as volume from my Docker-Compose.我想从我的 Docker-Compose 将 Azure 文件共享作为卷安装。 The example I have from Microsoft is to use Azure CLI .
我从 Microsoft 获得的示例是使用Azure CLI 。 How can I achieve the same, but with
docker-compose
?我怎样才能达到同样的效果,但使用
docker-compose
?
The following docker-compose
does not work for me as I am unable to install azure_file
driver in my Windows environment, which has also been deprecated.以下
docker-compose
对我不起作用,因为我无法在我的 Windows 环境中安装azure_file
驱动程序,该环境也已被弃用。
docker-compose.yml docker-compose.yml
version: "3.7"
services:
web:
build: .
image: flask-app
container_name: flask-app
ports:
- "5000:5000"
volumes:
- code:/code
depends_on:
- redis
redis:
image: redis
volumes:
code:
driver: azure_file
driver_opts:
share_name: myacishare
storage_account_name: mystorageaccount
Dockerfile Dockerfile
FROM python:3.8
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
app.py应用程序.py
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host="redis", port=6379)
@app.route("/")
def hello():
redis.incr("hits")
return "This Compose/Flask demo has been viewed %s time(s)." % redis.get("hits")
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
requirements.txt要求.txt
flask
redis
docker plugin install docker4x/cloudstor:azure-v17.03.0-ce --grant-all-permissions --alias azure CLOUD_PLATFORM=AZURE AZURE_STORAGE_ACCOUNT="[account name]" AZURE_STORAGE_ACCOUNT_KEY="[access key]"
this version of cloudstor works for me, but you can try other options from https://registry.hub.docker.com/r/docker4x/cloudstor/tags这个版本的cloudstor适用于我,但你可以尝试https://registry.hub.docker.com/r/docker4x/cloudstor/tags中的其他选项
answer from: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-volume-logging-drivers#using-your-own-volume-or-logging-driver答案来自: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-containers-volume-logging-drivers#using-your-own-volume-or-logging-driver
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.