At this point we have the ability to create a new custom image out of our Docker file and we can do
so by running docker build dot 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 idea and running Docker run and then placing the ideas in there.
Now when we run this command an instance of our image we created we'll get a new container and inside
that we're going to be running an instance of a server.
So I'll hit enter and there we go we've got our copy of readies and again all the warnings.
You can totally ignore now.
One thing I want to point out here is that having to execute Docker run and then paste in that I.D.
I don't have anymore about having a pasting that I.D. 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 red S or Docker run.
Hello world.
In those cases we didn't have to memorize an I.D. 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 we're going to 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 I.D. 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 going to see all projects in Docker trying to follow this convention as much as possible.
And you might be wondering why some other images that we've been able to use have more simplified names
like simply reticence or hello dash world or busy box.
Well all those are community images.
They're 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 darker ideas.
All right.
So let's give this a shot and see how it works.
So I'm going to flip back in my terminal and we are going to execute docker build dash t your Docker
idea.
So for me it's Steven Greider for you it's probably gonna be something else slash whatever you want
the name of the project to be.
So I'm going to use red as you can do red as you can do read a server.
Really anything goes here.
A colon and I'll say it 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 built context which again is the source
of all the files and folders that are going to going to be 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 to all that in there we'll run that and then the output down here says successfully
built the image I.D. but then it tagged it as this name.
And so now we can start up a container out of this image by running Docker run and then using the name
that we just provided of Steven Greider or whatever your tag is slash red it's and then you do not have
to actually specify the version on the end.
You can simply leave it as your doc right.
You slash redness if you don't put on the version on the end then the latest version of the container
or mutilated 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 I want to throw out here just because you might see some documentation
it 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 dash to you right here.
So we call this process tag in 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.