-: At this point, we have the ability to create
a new custom image out of our Dockerfile,
and we can do so by running docker build.,
the output from all that is this very last line
right here that says,
"Successfully built, blah, blah, blah."
This is the idea of the image that was just created.
So we can now create a container out of this image
by copying the ID and running docker run,
and then placing the ID in there.
Now, when we run this command,
an instance of our image we created
will get a new container and inside that,
we're going to be running an instance of Redis Server.
So I'll hit enter and there we go,
we've got our copy of Redis.
And again, all the warnings, you can totally ignore.
Now, one thing I wanna point out here
is that having to execute docker run,
and then paste in that ID,
well, I don't have anymore,
but having to paste in that ID is kind of a pain.
And it sure was a lot nicer earlier in the course
when we were able to do stuff
like just simply docker run redis or docker run hello world.
In those cases, we didn't have to memorize an ID to use.
So we can actually do the same by slightly changing
the form of the docker build command.
Here's what we're gonna do.
We are going to run docker build,
and then we're gonna add on this little argument right here
that is going to tag the image that is created,
and make it a lot easier to refer to it
by a name that you and I can customize.
The convention for this is your Docker ID, a slash,
the name of the project that you're working on,
a colon and then the version,
which traditionally is going to be latest
whenever you are building the newest version of an image.
But in general, that is supposed to actually be a version.
So traditionally, a number or for the latest version
of your image, you simply say, "Latest."
Now, this is a convention right here.
You're gonna see all projects in Docker
trying to follow this convention as much as possible.
You might be wondering why some other images
that we've been able to use have more simplified names
like simply Redis or Hello-World or Busy Box.
Well, all those are community images.
They are images that have been created by people
in the community and kind of open-source
for very popular use.
Anytime that you are creating an image of your own,
you're always going to prefix it with your Docker ID.
All right, so let's give this a shot and see how it works.
So I'm gonna flip back over my terminal,
and we are going to execute docker build-t,
your Docker ID,
so for me it's Steven Grider,
for you, it's probably gonna be something else,
slash, whatever you want the name of the project to be.
So I'm gonna use Redis.
You can do Redis, you can do Redis Server.
Really anything goes here.
A colon and I'll say specifically, "Latest."
And then don't forget, after all that stuff,
we still have to put in that dot at the very end.
Still need to specify that build context,
which, again, is the source of all the files,
and folders that are to going to used
to build your container out.
One quick reminder, we're not really doing a lot
with this build context yet,
but we will use it for something later on in the course.
All right, so once you got all that in there,
we'll run that and then the output down here says,
"Successfully built."
The image ID, but then it tagged it as, "This name."
And so now we can start up a container
outta this image by running docker run,
and then using the name that we just provided
of Steven Grider or whatever your tag is, slash Redis.
And then you do not have to actually specify
the version on the end.
You can simply leave it as your Docker ID slash Redis.
If you don't put on the version on the end
then the latest version of the container,
or the latest version of the image will be used by default.
So I'll run that and sure enough,
we get our Docker image running.
All right, so one last quick kind of nitpick thing
that I want to throw out here,
just because you might see some documentation
that looks a little bit confusing.
Technically, the version number on the very end here,
this is technically the tag.
Now, the entire process of what we just did
is known as tagging the image,
and even the argument we used was -T right here.
So we call this process tagging the image,
but technically just the version on the end is the tag.
Everything else on here is actually
like the repository or the project name.
So just a little bit of a nitpick.
I just want you to be aware of that.
All right, so that's pretty much it.
Let's take a quick break,
and we'll continue in the next section.