We just graft at such Docker file with different instructions like World Deal, Export, Scorpion,
so on.
And now it's time to build our cast on Docker image using this Docker file.
In total, there are eight instructions, but you only build Broaddus.
You'll see that Docker will actually run seven different steps.
And such last step where we used a CMG instruction will be executed only when container based on such
image will be started this way.
There was no need to ram, it seemed when actual build products will be running.
It means that it will stop after a big amount this one.
All right.
Let's now build this custom Docker image.
And for that, let's go to the terminal in order to have more space here.
And now let's see Defroster two API folder.
Let's see the two desktop images gallery in my case API.
Make sure that the U.S. API folder as well.
And here, if I at least files and folders, I'll find doggerel file and no inside of these directory,
please enter on command Docker Build Dot Dot as usually represents current working directory and it
is API folder and Docker will attempt to find Docker file inside of this directory.
Of course, if you want, you could use here and also file, for instance, Relative Path Desktop Image
Gallery API.
This will also work what is already inside of the e-Bay folder.
It makes sense to use just dot.
All right.
Let's now run, build process and see step by step what Docker will do.
Run.
Throws it to laws build definition from Docker file, it means Docker file was found next.
It starts with step number one with instruction from and it downloads by it, an image from the Docker
hub.
And here with exact stack 3.9.
This image consists of multiple layers of this way.
Here you'll see that the different layers are downloaded here.
Here, for instance here.
Here was a large layer, this 50 megabytes.
Let's wait a bit until those letters are downloaded.
After the Lord, the doctor extracts the contents of corresponding layers, for instance, here you
see extract operation, all next steps doctor will complete much faster.
It just needs time to download all those layers from Docker hub.
Docker just greeted the working directory, a step number two, and on step number three, Docker has
corporate the AP file and baby file, but look into that newly created working directory.
Hop on the next step.
Step number four Docker ranks command baby installer.
And here on this step, using baby, we installed the API and we package.
This package is used on the next step step number five in order to generate list of all requirements
and socialist is stored in the file requirements.
But the.
This file was created and the next step, step number six, we ran one more comment and we install all
requirements listed in the requirements to file using paper.
And finally, all remaining files located in the API folder.
Our project files are copied to the destination working directory, less up inside of the image and
after step number seven Docker finishes creation of the Docker image and it exports it to the image.
Here you see that it exposed different layers and basically Docker has created separate layers for each
build step.
Here, here or here, for instance, and later on, if you need to perform attribute of the same image,
Docker might reuse same layers as we're already created before.
For instance, this layer and we will have a look at that a bit later in this course.
Finally, Docker has redone image with such success.
Here it is, and now we have access to this newly created image.
And now let's have a look at the list of the images that are available for use locally on your computer.
Using command Docker images and now you should see two different images.
One is called Hello World.
It is name of the repository and another name is none.
And this that image that we just built here was if has.
This custom in which doesn't have any repository name and doesn't have any tech because we didn't specify
them, but I see that such image was created several minutes ago and the size is almost one gigabyte
size of this image is relatively large, and Doka rolled because we actually used a large base image
that the sculpt python.
This one, I decided to select this base image for our API project because it has all necessary dependencies
inside and we will be able to run smoothly.
Python Flask application of here using this base image.
Also, you might find a repository called Helloworld and this data repository that we downloaded before
when we executed Commando Carawan a rolled.
That is the most simple and the most the smallest and bailable image Addo-Carr.
And its size is just 13 gigabyte.
All right now, we are actually able to create new container based on this image using image i.d.s.
But honestly, I don't like using IDs of the images.
It is not convenient this way.
Let's quickly rebuild this image and add to it a repository name, and let's name it.
For instance, images gallery API, and we will look at any tech.
In such case, Docker will automatically adtech latest.
All right, let's rebuild our image and you'll see that no build process will go much, much faster.
It will take just several seconds.
We will use same comment as before Docker build.
Dot Dot represents current directory and afterwords.
Lets that image using option DST and here will be repository name images.
This gallery, this API you could choose, of course, any name you want, but I recommend to you to
just mean the full names.
All right.
Here, after calling, you are also able to specify attack, but I will keep this part empty.
In such case, Docker will attack.
Latest.
So let's start build Broaddus once again started.
Count seconds.
And process was finished just in four seconds.
And the reason for that is the Dulquer history used guest data that it stored during previous build
brought us, for instance, on this step number one, Dulquer didn't pull all necessary layers of this
Docker image called Python, because all those layers were already pulled from the Docker hub and stored
locally.
That's why Docker has simply law that those letters from internal storage.
Also, you see that on the next steps we see Cast Hero here or for instance, here and I told you,
the Docker has created separate layers of the image at each step Europe or, for instance, here.
And those steps in Docker, a file where are not modified, for instance, such file in our API, a
folder remained unchanged.
This way, there was no need to recreate such layer.
It remains unchanged this way.
Docker simply reused previously created layers this way.
Such a rebuild process went much, much faster.
Finally, it exported result in glare of the image.
It has created image with such house, and it has given name image as gallery API.
The resulting image?
And now, if I enter Docker images, I'll find out that there was a repository, title images, gallery
API or these custom image with such ID and there is added latest.
And that's how Docker behaves by default.
If you don't specify it there.
It adds that latest and notice that Greece and time of this image did not change because we did not
recreate image, it simply has added new tech.
Thus, it image itself remained unchanged.
All right now we're able to proceed and use this image in order to create new container where we will
run Python Flask obligation.
And let's proceed with that.
After the small smallpox.