filmov
tv
Running applications in Docker [2024] (Python + FastAPI example)

Показать описание
Run applications with Docker!
What is Docker? Docker is a virtualization technology that allows you to build lightweight images. Docker shares the kernel with the host machine instead of running its own kernel as traditional virtual machines do.
Say what...?
Let's put in simple terms: Docker is an engine that allows you to run your code in completely isolated environments. Docker builds are called images. When we run an application based on a Docker image, we create a container. Think of containers as instances of the image.
The great thing about Docker is that you can use the same build (image) and run it anywhere, so you get reproducible environments. You can get the same code that runs in production and run it in your machine. This is great for debugging and troubleshooting problems in production.
Docker images can be run on any platform that has a Docker engine, which allows us to replicate the same environment in production and in local. The process that runs off a Docker image is called a container.
This tutorial shows you how to dockerize a FastAPI application, but you can apply the same approach to any other Python application or applications from any other stack.
Let's go!
00:00 Introduction
01:39 Walk through the code
03:30 Installing dependencies and running the application
04:57 Install Docker
05:39 Creating a Dockerfile (touch Dockerfile)
13:37 Building a Docker image (docker build -t image:tag)
14:47 Listing Docker images (docker image ls)
15:35 Run the application as a Docker container (docker run)
17:56 Running the Docker container in the background (docker run -d)
18:24 docker ps (get a list of running Docker containers)
18:40 Step within a running Docker container (docker exec)
21:09 Stop Docker containers running in the background (docker ps + docker stop)
21:20 Run containers with a bash session
22:18 List all stopped containers (docker ps -a)
23:03 Resume execution of a stopped container (docker start)
24:22 Deleting stopped containers
25:31 Deleting a Docker image
26:05 Tutorial followups
26:54 Wrapup
#python #fastapi #render #devops #deployments #rdocker
What is Docker? Docker is a virtualization technology that allows you to build lightweight images. Docker shares the kernel with the host machine instead of running its own kernel as traditional virtual machines do.
Say what...?
Let's put in simple terms: Docker is an engine that allows you to run your code in completely isolated environments. Docker builds are called images. When we run an application based on a Docker image, we create a container. Think of containers as instances of the image.
The great thing about Docker is that you can use the same build (image) and run it anywhere, so you get reproducible environments. You can get the same code that runs in production and run it in your machine. This is great for debugging and troubleshooting problems in production.
Docker images can be run on any platform that has a Docker engine, which allows us to replicate the same environment in production and in local. The process that runs off a Docker image is called a container.
This tutorial shows you how to dockerize a FastAPI application, but you can apply the same approach to any other Python application or applications from any other stack.
Let's go!
00:00 Introduction
01:39 Walk through the code
03:30 Installing dependencies and running the application
04:57 Install Docker
05:39 Creating a Dockerfile (touch Dockerfile)
13:37 Building a Docker image (docker build -t image:tag)
14:47 Listing Docker images (docker image ls)
15:35 Run the application as a Docker container (docker run)
17:56 Running the Docker container in the background (docker run -d)
18:24 docker ps (get a list of running Docker containers)
18:40 Step within a running Docker container (docker exec)
21:09 Stop Docker containers running in the background (docker ps + docker stop)
21:20 Run containers with a bash session
22:18 List all stopped containers (docker ps -a)
23:03 Resume execution of a stopped container (docker start)
24:22 Deleting stopped containers
25:31 Deleting a Docker image
26:05 Tutorial followups
26:54 Wrapup
#python #fastapi #render #devops #deployments #rdocker
Комментарии