In the last section we broke down the contents of our Docker file and got an understanding of the overall
contents or structure of it.
We now know that there's a handful of instructions that we can use to customize how our image is built.
These are three of the most important instructions to know and we'll introduce a handful of other ones
over time.
In this section I now want to kind of break down what was really occurring behind the scenes with each
of these instructions.
We're going to first begin by taking a look at a little analogy.
So this is going to be an analogy to help you understand the structure or purpose of those lines of
configuration inside that darker file so quick analogy I can tell you writing a doctor file is a little
bit just like being given a computer.
So a brand new computer with no operating system on it and being told to install google chrome on there.
So I want you to imagine what you would do if I handed you a computer that has no operating system on
it.
And I told you you have to install google chrome on here but here is probably what you would end up
doing.
The first thing you might do is try turning on that laptop or turning on that desktop.
And when you turned it on you would probably maybe see some boot up process but then you would eventually
be given a message that says something like hey sorry no beautiful drive or no operating system.
I'm just an empty computer.
I don't know what to do.
So the first thing you would probably do is install an operating system you need an operating system
on that computer in order to go through all these sequential steps on here.
If you want to download Google Chrome you have to go and download it from somewhere by opening up your
Web browser and you have to navigate to Chrome Doug Google dot com.
You have to download the installer and open a file explorer and then execute that installer.
So those series of steps right there those are all steps that are facilitated by the installation of
that initial operating system.
If you didn't have an operating system there would be no default browser to start up.
You would not have a file or folder explorer to startup and you probably would not have any way to run
an executable file.
All of these steps are kind of preceded or dependent upon having an initial operating system so then
going through all those initial steps eventually you would be able to execute the chrome executable
and start up that browser.
So these steps right here very similar to what we just did inside that darker file when we specified
that base image of Alpine.
That was a lot like installing an initial operating system by default when we create a container or
me when we create an image.
We have an empty image.
There's really nothing inside there.
No infrastructure no programs that we can use to navigate around a file or folder system.
There's nothing we can use to download or install or configure dependencies.
There's nothing in there.
So the purpose of a specifying a base image is to kind of give us an initial starting point or an initial
set of programs that we can use to further customize our image.
So that is the purpose of that first line from Alpine.
We said that we wanted to use the Alpine Docker image as kind of an initial operating system or a starting
point for the image that we are creating.
Now your very initial follow up question might be well why did we use Alpine.
What is Alpine.
So that's a good question.
Another brief aside why did we use Alpine as a base image.
Well back to you.
I'm going to kind of pose a question I'm going to say to you why do you use Windows or Mac OS or Ubuntu
or some other Linux distribution on your personal computer.
The answer is that you use any particular operating system because it kind of suits your needs.
Windows might have a program that you need to use your computer effectively you might use Mac OS because
it has a built in terminal and that's really nice for you.
In other words you use one of these default operating systems because it has a set of prenatal programs
that is useful to you and what you are trying to accomplish.
So we just made use of Alpine as a base image as kind of like an operating system of sorts because it
includes a default set of programs that are very useful for what you and I are trying to accomplish.
We are trying to install and run reds and the Alpine based image has a set of programs inside of it
that are very useful for installing and running red is the command that was or the program that was
most useful for you and I for installing and running gratis was found on the second line of the docker
file.
We had said run a P.K. ad update read this.
This is not a docker command right here.
This line has nothing to do with Docker whatsoever.
AP K is a program called Apache package something I think it is a package manager that comes pre installed
on the Alpine image and we can use that package manager that is built into alpine to automatically download
and install it read it for us.
So we made use of Alpine because it had this package manager program automatically included inside of
it.
And so it made it a very convenient thing to start with inside of our Docker file.
All right.
So I think we got a better idea of what's going on with this Frontline and I think we've got kind of
a reasonable idea of at least the right hand side of this one.
You know the actual like Commander line of code that was executed but we still need to have a better
understanding of what run over here is doing have a better understand standing of what command is doing
and kind of put this entire equation together.
So quick break and come back an section and do a little bit more of a deep dive.
So I'll see you in just a minute.