0% found this document useful (0 votes)
15 views10 pages

Basics of Docker For Flask

This module teaches the basics of Docker, focusing on containerizing a Flask web application. It covers installation, understanding Docker images and containers, and provides a step-by-step guide to building and running a Dockerized Flask app. Key takeaways include the importance of Docker for consistent application deployment and the use of Dockerfiles to define container builds.

Uploaded by

jomarroxas10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views10 pages

Basics of Docker For Flask

This module teaches the basics of Docker, focusing on containerizing a Flask web application. It covers installation, understanding Docker images and containers, and provides a step-by-step guide to building and running a Dockerized Flask app. Key takeaways include the importance of Docker for consistent application deployment and the use of Dockerfiles to define container builds.

Uploaded by

jomarroxas10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Basics of Docker for Flask

Containerizing your first web application!


Objectives of this Module:

• Understand what Docker is and why it's used.


• Install and set up Docker.
• Learn about Docker images and containers.
• Containerize a Flask application.
• Activity: Run a Flask app inside a Docker container.
What is Docker?

 Definition: Docker is a platform for developing, shipping, and running applications in


containers.
 Why Use Docker?
• Ensures app runs the same in all environments.
• Reduces dependency issues.
• Lightweight and fast.
Installing Docker

 Steps to Install Docker:


 Download and install Docker Desktop (Windows/macOS) or Docker Engine (Linux).
 Verify installation with docker --version.
 Run docker run hello-world to test.
 Tip: Use Docker Desktop for an easier setup.
Understanding Docker Images and
Containers

 Docker Image: A blueprint for creating containers.


 Docker Container: A running instance of an image.
 Commands:
 docker pull <image>: Downloads an image.
 docker run <image>: Runs a container.
 docker ps: Lists running containers.
Writing a Dockerfile for Flask

 What is a Dockerfile?
 A script that defines how to build a Docker
image.

 Basic Dockerfile for Flask:

 Tip: Keep the image lightweight by using


python:alpine.
Building and Running the Dockerized Flask
App

 Steps:
 Navigate to the Flask app directory.
 Build the image: docker build -t flask_app .
 Run the container: docker run -p 5000:5000 flask_app
 Open http://localhost:5000 in a browser.
 Tip: Use docker logs <container_id> to debug issues
Activity

 Task: Containerize your Flask app from Module 1.


• Write a Dockerfile.
• Build and run the image.
• Test the app in the browser.
 Submission: Save your Dockerfile and submit a screenshot of the running app.
 Tip: Experiment by modifying the CMD command.
Summary

 Key Takeaways:
• Docker simplifies deployment by containerizing applications.
• Images are blueprints, and containers are running instances.
• Dockerfiles define how to build a container.
• Running a Flask app in Docker ensures consistency across environments
 Next Steps: Learn about Docker Compose and multi-container applications in Module
3.
Basics of Docker for Flask
Containerizing your first web application!

You might also like