This document summarizes a workshop on using Docker for Python development on Azure. It introduces Docker as a way to package code and dependencies to be deployed as a container. It then walks through steps to create an Azure VM with Docker Machine, build a Python web app and Docker image, and deploy the containerized app to Azure using Docker and Docker Compose. The workshop aims to demonstrate how Docker can improve deployment processes for Python apps on Azure.
10. Workshop Steps
• Use Docker-Machine to create VM on Azure
• Build your Python web app
• Build Docker Image and deploy to Azure by
Docker
• Improve deployment process by Docker-Compose
11. Step1
Use Docker-Machine to Create VM
• 1. Download your publish setting file
• 2. Install Docker & Docker Machine
• 3. Use Docker-Machine to create a virtual machine
on Azure
19. Create a Virtual Machine on
Azure (with Docker)
• Create a Machine on Azure with Docker
$ docker-machine create -d azure --azure-publish-settings-file PUBLISH-
SETTING-FILE A-VERY-UNIQUE-NAME
• Setup docker environment to connect to your new
instance
$ eval `docker-machine env A-VERY-UNIQUE-NAME`
23. Demo
• Some basic Docker commands
• docker info
docker pull ubuntu
docker run ubuntu ls
docker images
docker ps
24. Step 2
Build Your Python Web App
• 1. Add requirements.txt
• 2. Build a very simple python web app
• 3. Write a Dockerfile
• 4. build the image
• 5. Deploy it to Azure
29. Build the image
• Build the image
$ docker build -t myapp .
• List your images
$ docker images
30. Deploy to Azure
• Run redis first
$ docker run -d --name myredis redis
• Check status
$ docker ps
• Run your web app
$ docker run -d -p 80:5000 --link myredis:redis myapp
• Check status
$ docker ps