Modern Python Projects Transcripts
Lecture: Publishing on Docker Hub
0:00 The easiest way to use the docker image that you have created is to publish it
0:04 on Docker Hub. docker hub is displays where you can find different docker images.
0:09 So, for example, if we search for python,
0:12 we can see the official python image.
0:16 And here, if we search for tags,
0:21 here is the image that we used to build our own uptime and website image.
0:25 So to publish an image on docker Hub,
0:28 make sure that you have a docker account,
0:29 because first, we'll have to log in.
0:32 So first step is to run docker log in command and it will ask you for
0:38 your user name and password. So I'm gonna type that behind the scenes.
0:43 Now make sure that you actually have a build image.
0:46 As you can see, last time I cancelled.
0:48 so I will have to build it again.
0:52 And now we have to tag our image.
1:00 So, first you specify the local image.
1:02 As you can see, when we were building,
1:04 we use the uptimer website name for the image and then you specify your user
1:09 name on docker hbb slash(/) the name of the repository and tag that you want to
1:14 use, latest is one of the most common ones,
1:18 and this will suggest users that this is the latest version of your image.
1:22 But you can also use stuff like version 1, version 2 or whatever you want.
1:28 And once you have tagged your image,
1:30 we just have to run Docker,
1:31 push and specify the stag. Well,
1:40 I forgot to copy the latest tag,
1:42 but, as you can see by default will be using latest.
1:45 So while this is running, let's talk about the images on docker Hub.
1:50 Basically, everything that you published on docker Have is a public image.
1:55 So if you're in a situation where you want to publish private image because you don't
2:00 want to share the code with anyone,
2:02 there are some alternatives. Like for example,
2:04 GitLab has the container repository.
2:07 So,if you create a private project on git lab,
2:10 you can also build a docker image and store it on GitLab, so that that's one solution
2:14 that you can use for private docker images.
2:17 Another idea would be to just start paying for a paid docker account,
2:20 and with that, you can have unlimited private repositories.
2:24 I think even on the free account you have one free private repository where you can
2:29 push some images without sharing them with the rest of the world.
2:32 Okay, so this is done.
2:35 Let's actually see how it looks like in my profile, if I go here.
2:44 Yeah. Yep. Here. I have it.
2:49 uptimer Website updated a minute ago.
2:52 So once you have your image published on Docker Hub,
2:54 you can just use this command to,
2:56 pull this image on any other computer,
2:59 so let's try to deploy our image somewhere.