A RESTful service based on the Flask Python framework
This setup requires Docker to run on your PC. I've used Windows and Powershell to run the commands. You can find the downloads for Windows and Mac at the respective links.
The Create an image from the Flask service and run it and upload it as a web service, follow these steps:
docker build -t <image-name> .
Where -t is used to set the tag for the image to create. The dot (.) at the end refers to the file path of the Dockerfile. For the build to work, the whole path can't contain any spaces. Something like C:\test would be fine, but "C:\test\this app" wouldn't be.
An example:
docker build -t flask-rest .
docker run -p 8000:8000 <image-name>
The property -p sets the port mapping for the container. As the script exposes port 8000, this should be mapped to another port of the container. You might change the second value (right) to change the port to speak to.
An example:
docker run -p 8000:8000 flask-rest
-
Login to docker from command line
docker login --username <docker-id> --password <docker-hub-password>
It is more secure, to use --password-stdin to login to your docker account:
$ cat ~/my_password.txt | docker login --username foo --password-stdin
More information can be found in the Docker Docs
-
Push the image to Docker Hub:
docker push <docker-id>/<name-of-image>:v1.0.0 .
-
Prepare for upload:
pip install --user azure-cli
If this doesn't work, download the installer and follow the instructions up on Azure Docs
-
Login to your container registry:
docker login <acr-name>.azurecr.io
-
Push to your registry:
docker tag <image-name> <acr-name>.azurecr.io/<repo-name> docker push awesome.azurecr.io/<repo-name>
More info in the Azure Docs
This chapter is in development.