Modern Python Projects Transcripts
Chapter: Deployment
Lecture: Docker containers and kubernetes

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Yet another way to deploy your application is to turn it into a container.
0:04 This way got very popular with the introduction of docker,
0:07 and now a lot of containerized applications are running under the kubernetes orchestration.
0:15 This is a great solution if you have a massive application that you need to quickly
0:19 scale up or scale down, depending on the traffic spikes or if you deploy your
0:25 application multiple times per day, so you need to set up some continuous delivery pipeline
0:30 On the other hand, learning kubernetes only to set up a cluster for
0:35 a website that has less than a few 1000 visitors per day is a terrible overkill
0:39 But the idea of containers is pretty great,
0:43 and I recommended even for medium and small projects.
0:46 Basically, if you can build a container with your application and make it work on
0:51 your computer, then you can take this container deployed on the server,
0:55 and it will also work there.
0:57 I saw this joke on the Internet when one developer was saying it works on my
1:02 machine and his boss responded, Okay,
1:04 then we will ship your machine to the customer and the caption was.
1:09 That's how docker was born, and I think it pretty accurately shows how docker and
1:14 containers work. I use the word container a lot,
1:17 so if you're new to Docker,
1:19 you might be confused. Container is basically a package that contains your application and all
1:25 the dependencies that it requires, so it's very similar to the executable python application that
1:31 we built in the last chapter.
1:33 It's like an executable application that docker can run.
1:37 It can be a Django or flask website.
1:40 It can be a command line application,
1:42 or it could be a GUI application.
1:44 It can be basically anything that you can run on your computer.
1:48 So, once we have such container,
1:50 how do we deploy it? One way is to spin up a virtual private server
1:54 install docker and then run this docker container.
1:59 Some hosting providers can further simplify this process.
2:03 For example, digital ocean has those one click applications that lets you create a server
2:08 with some preinstalled software, and as you can see,
2:11 they have one for docker. So when you click this create docker droplet,
2:16 it will create a server with docker installed and ready to use.
2:20 You can also search for a phrase managed docker hosting.
2:23 This will return you a list of different services that works like Heroku.
2:28 But for Docker Containers, they will take care of,
2:31 setting up everything for you, and all you need to do is to give them
2:35 your container. And if your application is really big and you need a lot of
2:40 machines, you can use kubernetes.
2:42 The main difference between kubernetes and Docker is that kubernetes works across multiple machines.
2:48 That's why we often say kubernetes class
2:50 On the other hand,
2:52 docker runs on a single machine.
2:55 You can create and manage a kubernetes cluster yourself,
2:59 but you can also search for manage kubernetes platforms.
3:03 This will return you a list of companies that can setup a kubernetes cluster
3:06 for you and give you some interface to easily.
3:09 Manage it. As you can see,
3:11 we have a manage kubernetes from digital ocean,
3:15 something from ovh and so on.