Essential Docker for Python Flask Development
4.7 (45 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
503 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Essential Docker for Python Flask Development to your Wishlist.

Add to Wishlist

Essential Docker for Python Flask Development

Learn how to effectively use Docker and Docker Compose to develop production ready applications
Best Seller
4.7 (45 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
503 students enrolled
Created by Jorge Escobar
Last updated 12/2016
English
Current price: $10 Original price: $75 Discount: 87% off
5 hours left at this price!
30-Day Money-Back Guarantee
Includes:
  • 2.5 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • You will learn the fundamental concepts for the design of Docker Containers, specifically for Flask web development
  • You will be introduced to the Dockerfile structure
  • You will learn how to setup a server cluster using Docker Compose
  • You will learn how to effectively interact with containers, write tests and debug applications
View Curriculum
Requirements
  • A computer with internet access and administrative access to install packages
  • Good understanding of how to use the command line interface, internet and code editors
  • Good knowledge of the Flask web framework
Description

This course will teach you the essential knowledge required to integrate Docker in your everyday development flow. Docker is an easy way for developers to recreate a production-level server cluster locally in their desktop or laptop using very few resources.

A lot of companies and startups are moving to Docker, because it speeds up the development process and reduces the amount of debugging that occurs when they create software against different versions of their operating system and libraries.

The course covers the basic concepts and goes through the setup of different use cases, specifically Flask-related, from a simple web application to MySQL and MongoDB multi-server setups.

At the end of the course students will be able to write solid Dockerfiles and Docker Compose configuration files that will allow them to write software against reliable environments and without the need to install packages like Python, MySQL or MongoDB. Just install the simple Docker client for Windows or Mac and you’re set to go!

If you already know the basics of Flask and you are interested in how to setup Docker containers for their development, this is the course for you.

The course is divided in 3 sections:

  • Introduction which covers all the concepts necessary to understand how Docker works and how to install it

  • Simple Flask Containers which gently introduces to the basics of containers and how to write a good Dockerfile and how to interact with the containers

  • Docker Compose which goes into the composing part of Docker, where with one file you can spawn a complete architecture stack, like an application server and a database server running in parallel and synchronized as production environments do

The course has more than 2 hours of video tutorials as well as the source code at the end of each section, so that you can fork and play with the Docker setups.

The course can take anywhere from 1 to 3 days to complete based on how much material the student completes daily.

Additionally we’re constantly updating the course, adding contents thanks to the feedback of our students.

Join this course and continue your path to becoming a professional backend web developer!

Who is the target audience?
  • Programmers and developers with basic Flask knowledge who want to expand their Docker skills
  • Application architects who want to understand better how to scale their applications
  • Startup CTOs who want to understand better best practices for application deployment
  • Computer Science Students who want to get exposed to real life concepts
Compare to Other Python Courses
Curriculum For This Course
20 Lectures
02:21:17
+
Introduction
6 Lectures 33:10
  • What do we want to accomplish in this course?
  • Prerequisites
  • What do I need to have to complete this course?
Preview 01:03

  • What is Docker exactly?
Introduction to Docker
02:41

  • The Docker Clients
    • Docker is available for both Windows and Mac Operating Systems as a native client that utilizes both of those OS’s hypervisor capabilities
  • Install Docker for Mac
    • Get dmg
    • Run it
    • Click the Whale to get preferences
    • Go to File Sharing and add "/opt"
  • Check the versions
$ docker --version
    Docker version 1.12.0, build 8eab29e

$ docker-compose --version
    docker-compose version 1.8.0, build f3628c7

$ docker-machine --version

docker-machine version 0.8.0, build b85aac1


Installing the Docker Client
04:54

Check the hello-world container docker run hello-world

  • What did just happen?
    • Docker tried to check if it had a hello-world "image"
    • Since it didn't find it, it went to Docker Hub to see if it could find it there
    • It found it and downloaded the "latest" version
    • It then created a "container" based on this image
    • The container ran following the commands on the image's "Dockerfile"
Preview 05:09

  • Images
    • Versions (:version)
    • You build an image from a Dockerfile using docker build
  • Containers
    • Running or not running
      • Use docker ps to see running containers and docker ps -a to see all containers
      • You start a container using docker run or docker start
      • You stop a container using docker stop
Docker Concepts
11:21

Foreground vs Background

  • Foreground: Starts the process in the container and attach the console to the process’s standard input, output, and standard error
  • Background or detached: Containers started in detached mode exit when the root process used to run the container exits
  • Example foreground container
    • Run an Ubuntu server docker run -it ubuntu:16.04 /bin/bash
      • Here we pass the -i flag which means "Keep STDIN open" i.e., the keystrokes are routed to the container
      • We also pass the '-t' flag which means "Allocate a pseudo-tty" or terminal
      • We pass the image with a version
      • The /bin/bash is an optional command we can pass the container when it starts
  • Example background container
    • Run an nginx web server docker run -d -p 80:80 --name webserver nginx
      • Here we pass a -d flag, which means "detached" or Background
      • We also pass a '--name' flag, which allows us to reference the container with a name
      • Go to localhost. "Welcome to nginx" should be up
      • Check docker ps and you should see the container
      • Stop the container using docker stop webserver
Foreground vs Background Containers
08:02

Review the fundamental concepts of Docker.

Section 1 Quiz
4 questions
+
Simple Flask Containers
3 Lectures 30:56
  • Just using python hello.py
  • Write the Dockerfile
  • Build the image with docker build -t hello-app .
A Basic Flask Container
11:53

  • Run the container with docker run -d -p 5000:5000 --name hello-server hello-app
  • Check that the container is running
  • Go to localhost:5000. You should see Hello, World!
  • Stop the container using docker stop hello-server
  • Check that the container is not running with docker ps
  • Check the container is still available with docker ps -a
  • You can restart the server using docker start hello-server
  • You can log in to the server using docker exec -it hello-server bash
  • Caveat: if you change the code, it's not reflected on the container. We'll fix that next.
Running our Basic Flask Container
09:42

  • Write the Dockerfile
  • Build the image with docker build -t guni-app .
  • Run the container with docker run -d -p 80:80 -v /opt/docker-guni-hello:/app --name guni-server guni-app
  • Note the -v flag. That means now the local directory is "mounted" on the container, and any changes you make are reflected on the server, thanks to the --reload flag.
A Hot Reload Gunicorn Flask App
09:21

Review the Flask concepts and Dockerfiles.

Section 2 Quiz
2 questions
+
Docker Compose
10 Lectures 01:15:56

What is Docker Compose?

  • Docker Compose allows you to programmatically spawn multiple containers specifying the relationship between them
  • The docker-compose.yml
Preview 04:36

Here we will build a simple Flask counter application that uses MySQL as its backend.

The MySQL Counter App
10:04

Here we go through the structure of the docker compose file.

The docker-compose file
08:09

  • Build the image with docker-compose build
  • Run the container with docker-compose up
  • Initialize tables with docker exec -it counterapp_web_1 python dbinit.py
  • Hit / and see the counter incrementing every time you refresh the page
Starting our Docker Compose App
06:41

  • To use the app container docker exec -it counterapp_web_1 /bin/bash
  • To use the mysql server do docker exec -it counterapp_db_1 mysql -uroot -prootpass
  • If you do any changes and need to reset the containers, you can do docker-compose rm -v
Interacting with the Containers
06:31

  • Run tests by doing docker exec -it counterapp_web_1 python tests.py
Running Tests
08:25

Here we will create a similar Flask counter app, but this time using MongoDB as the database and using the factory pattern.

A MongoDB Counter App
08:55

  • Build the image with docker-compose build
  • Run the container with docker-compose up
  • Hit / and see the counter incrementing every time you refresh the page
  • To explore the mongodb database, open a new tab and do docker exec -it counterapp_db_2 mongo
    • Do use countershow collectionsdb.counter.find()
Starting up the App
08:27

  • To run tests, do docker exec -it counterapp_web_2 python tests.py
Testing the App
08:46

Using PDB with Docker Compose

  • Start the database as it's own demon service: docker-compose up -d db
  • Now start the application with pdb enabled: docker-compose run --service-ports web
  • You will get the live log of just the app and you can stop with CTRL-C
  • Try adding a pdb on the code
  • To stop the db docker-compose stop db
Using PDB with the Docker Container
05:22

Review the concepts of Docker compose.

Section 3 Quiz
2 questions
+
Conclusion
1 Lecture 01:15
Conclusion
01:15
About the Instructor
Jorge Escobar
4.5 Average rating
758 Reviews
4,805 Students
5 Courses
Technologist, entrepreneur and open source fanatic

From Zero is an educational project created by Jorge Escobar, a technologist, entrepreneur and open source fanatic with more than 15 years of experience in the development of web applications in New York City.

Jorge has worked in well established companies like Yahoo!, Univision and MongoDB and has also been the technical founding member of various successful tech startups that have received multiple rounds of venture capital.

The biggest problem Jorge has experienced during his career is finding well rounded developers and he interviewed hundreds of them for positions in the teams he was leading. A constant pattern (no matter if candidates came from a good university or had a few years of experience) was the lack of practical, real world knowledge.

That’s why Jorge created From Zero, an educational project that would address those practical knowledge issues through training that builds hands-on experience and equip students with the tools required to be successful in today’s technology business needs.