WEBVTT

00:04.160 --> 00:08.240
In this lecture, I will show you how to build the image and store it in a registry.

00:08.360 --> 00:11.600
But first I will explain what registry actually is.

00:11.640 --> 00:16.960
Registry is where we store the Docker images that have been built by others, like the airflow docker

00:16.960 --> 00:19.520
image, which we just mentioned in the previous lecture.

00:20.400 --> 00:23.400
And we can also build and store images that we create.

00:23.720 --> 00:29.800
In our case, we will use Docker Hub to store our image, which again is a very popular image registry.

00:30.800 --> 00:34.720
So before we go to the next steps make sure that you have Docker Hub account.

00:35.240 --> 00:38.360
I will put the link to the website in the appendix of this section.

00:38.840 --> 00:40.920
And I will show you how it looks like.

00:41.360 --> 00:43.560
This is the actual Docker Hub URL.

00:43.600 --> 00:49.040
While creating the Docker Hub account, make sure that you store the username and password somewhere

00:49.040 --> 00:53.200
secure and that you can easily retrieve them as we will be using them soon.

00:53.200 --> 00:54.560
So let me sign in.

00:57.200 --> 01:05.360
I am signed in with my account and now we can go to repositories and from here we create the repository.

01:07.080 --> 01:10.280
So for the repository name give it a meaningful name.

01:10.320 --> 01:17.230
In my case I will name it YouTube API underscore LTE and you can name it the same.

01:18.110 --> 01:20.270
You can also add the short description if you want.

01:20.630 --> 01:26.230
In my case, I will leave it blank and then you can select between private or public.

01:26.510 --> 01:29.310
I will select public and I recommend you do the same.

01:30.070 --> 01:30.950
Press create.

01:34.110 --> 01:35.190
And there you have it.

01:35.230 --> 01:37.190
Now you can go back to VS code.

01:39.150 --> 01:42.110
And you can type in docker login command.

01:42.110 --> 01:47.310
So docker login minus you and your username in my case.

01:54.750 --> 01:56.390
You will be prompted for a password.

01:59.470 --> 02:03.830
And if you give it the right password you will see that the login is succeeded.

02:04.190 --> 02:09.870
If you don't get login succeeded, make sure that you are inputting the right username and the password.

02:10.590 --> 02:13.310
And from here we can run the docker build command.

02:13.350 --> 02:18.030
And we will also use the dash t flag for tagging of the image.

02:19.230 --> 02:21.030
So let me show you how it looks like.

02:24.550 --> 02:27.220
Here we specify the username.

02:33.020 --> 02:35.580
And here we specify the repository name.

02:38.220 --> 02:44.620
Tags are a good practice to use as you can specify the version environment, stability and other properties.

02:44.820 --> 02:47.420
In our case we will only use it to track the version.

02:47.460 --> 02:49.500
This version one point 0.0.

02:49.700 --> 02:54.900
The final dot that you see in the command refers to the build context, which is the current directory.

02:55.340 --> 03:00.820
This tells Docker to look for the docker file and any files to be copied from the current directory.

03:01.140 --> 03:02.300
Let's run the command.

03:02.420 --> 03:03.500
So we press enter.

03:05.100 --> 03:10.060
This will take some time depending on the base image how big it is, which for airflow is definitely

03:10.060 --> 03:11.220
not a lightweight image.

03:13.620 --> 03:16.300
We'll come back when it has completed the build successfully.

03:22.460 --> 03:26.020
As you can see here, the build has completed.

03:26.340 --> 03:32.100
You can see some of the Docker file commands which we wrote have also been executed.

03:32.220 --> 03:38.840
So what remains is we actually push the Docker image that we We created to our repository.

03:38.840 --> 03:47.120
For this, we use the docker push command again to specify the username and the repository name.

03:52.000 --> 03:55.200
Also, we specify the tag 1.0.0.

03:59.760 --> 04:04.040
This will also take some time, so we will come back when it has finished.

04:07.320 --> 04:10.680
Okay, it seems that it has completed and pushed the image.

04:10.680 --> 04:16.360
So if we go back to Docker Hub in our repository, we should see the image that we just pushed.

04:16.880 --> 04:17.920
Let's refresh.

04:19.840 --> 04:20.960
And there we have it.

04:20.960 --> 04:22.760
This is the image that we just pushed.

04:23.880 --> 04:24.800
And that's it.

04:24.840 --> 04:28.480
You have successfully built and pushed your own custom Docker image.

04:28.480 --> 04:29.320
That's all for now.

04:29.320 --> 04:33.600
In the next lectures we will go over the airflow architecture and directories.

04:34.000 --> 04:39.640
We need to understand how airflow works before we can build the docker compose file that will be used

04:39.640 --> 04:41.360
to run the airflow containers.

04:41.760 --> 04:45.760
So I will see you in the next lecture to go over the airflow architecture.
