I want to mount Azure File Share as volume from my Docker-Compose. The example I have from Microsoft is to use Azure CLI. How can I achieve the same, but with 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.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
FROM python:3.8
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
app.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
flask
redis