Modern Python Projects Transcripts
Lecture: Deploy Docker image on DigitalOcean
0:00 In order to deploy your Docker image on a production great server, you have to rent the server from somewhere, you might use Amazon.
0:09 You might use Linode, Digital ocean and just create a virtual machine install docker and
0:16 do everything manually. But some of those companies provide you with, like one click apps. For example.
0:22 Digital Ocean has this droplet that has docker pre installed. I think also Linode has something like that. But let's go with digital ocean.
0:32 So, when you go to the digital ocean marketplace and you search for Docker,
0:36 you will see this Docker one click app and here we have a create docker droplet button.When you click it,
0:44 you will be probably taken to the page where you can log in and then you'll be taken to digital Ocean Control panel.
0:56 We can also click, create droplets, go to the marketplace tab and search for Docker or just click this guy here Then we select the cheapest VM type.
1:09 And, I will select Frankfurt as the location of my droplet. Since I'm based in Europe and then here I will select all the ssh keys and
1:26 that's it. I could create droplet. And once this is ready, I can ssh to it. Once we have the droplet up and running, we can copy the ip and ssh there.
1:42 And I cannot. Is it still not ready. Now it is and we get permission denied because we should not log in as tutorials, User, we should use root.
1:56 So let's try one more time. Okay? Now it's working. And as you can see, if we run Docker -v,
2:08 we are using Docker. So everything seems to be working fine. To deploy our Docker image, we basically have to run the same command as we
2:16 did with play with Docker Playground. So Docker run, then expose the port and specify the name of our image. Let's actually use port 80 this time.
2:29 So first we specified the port on the host and then we specified the port in the container and everything seems to be working fine.
2:46 So, now we should be able to go to the browser. Open this IP and we should see our simple form. Let's give it a try and perfect.
3:01 Now our uptimeer website is up and running on the digital Ocean server. We are still using an IP. But you could connect the domain name here and
3:10 use it us any other website. Even though it's up and running, there are still two simple improvements that we can apply.
3:18 So first we have to handle the situation. When our droplet is rebooted, we want to have docker up and running each time we restart the server.