Upload files to Azure Storage from a python flask application on Azure App Service (using Docker)
234
Build docker image from the code:
docker build -f Dockerfile -t <app-name>:latest .
Run and test your new docker image locally (pass required env variables):
docker run -p 8080:8080 -e AZURE_STORAGE_KEY=<key> --rm <app-name>
Locate the image id by running docker images and tag existing image with your Docker Hub username:
docker tag <image-id> <dockerhub-username>/<app-name>
Push the image to Docker Hub:
docker push <dockerhub-username>/<app-name>
Go to azure portal and create a new "Web app for containers" and specify <dockerhub-username>/<app-name> as docker hub image repository.
Set the required environment variables in App settings. Also configure Azure to use the port that we specified in Dockerfile using below App setting:
WEBSITES_PORT=8080
Optionally, you can debug the container by going to kudu console at https://<azure-app-name>.scm.azurewebsites.net/
For more information, please see: Use a custom Docker image for Web App for Containers.
Content type
Image
Digest
Size
275 MB
Last updated
over 8 years ago
docker pull mastercoder/flask-docker-azure