-: In the last section,
we put together our very first Docker file
and then very quickly used it
at the terminal to build a new image.
However, we didn't really talk
about what was going on inside of here.
So in this section and the next, I wanna do a deep dive
on all the configuration that we added to the Docker file
and also what happened over at the terminal afterwards.
So let's get to it.
All right.
So I took every line outta that Docker file except
for the comments and put it into this diagram right here.
So you see from Alpine, run and command,
you'll notice that every line of configuration
that we put in there
looked kind of similar to the others.
Every line started off with a single word
that we refer to as an instruction.
This instruction is telling the Docker server
to do some very specific preparation step
on the image that we are trying to create.
The instruction from is used
to specify the Docker image
that we want to use as a base.
The run instruction is used to execute some command
while we are preparing our custom image.
And then the CMD
or command instruction specifies,
what should be executed
when our container, sorry,
when our image is used to start up a brand new container.
Every line of configuration that you are ever going to add
to a docker file is always gonna start off
with an instruction.
Now, we just used the three most
important instructions to know,
there are quite another,
quite a handful of other instructions out there.
We're gonna look at a handful of them
throughout the rest of this course.
But again, from, run and CMD
are the most important ones to know and understand.
After each instruction, we then provided an argument
to the instruction that kind of customized
how that instruction was executed.
So as you might guess, by putting from Alpine
we are saying we want to use a base image of Alpine
when preparing our image,
and we'll talk more about exactly
what that base image is doing for us in just a moment.
On the next one, we said we want to run this command.
This command was the argument
that was provided to the instruction.
And then for CMD down here at the bottom, well,
I bet you can guess, yeah, that is the argument to cmd.
All right, so that's what was going on
with the overall structure of the Docker file.
But that doesn't really explain a lot of the pieces
or kinda like what the intent of each of these lines were
outside of the comments that we added on there
while we were writing the Docker file.
So let's take a quick pause.
We're gonna come back to the next section
and we're gonna start to look
at the output that we got
inside of our terminal and try to understand
how each of those lines of configuration was interpreted
by the Docker server and used to build our image.
So quick break and I'll see you in just a minute.