- [Announcer] We've used quite a few images thus far
through this course, and now let's spend
a little bit of time talking about
how to manage and keep track of the images
we're working with.
So you can list the images that you've already
downloaded with the Docker images command.
It only lists the images you've already downloaded,
it's not the tool for finding images to download,
we'll cover that later.
So, docker images,
all right I can see
there are several images on my machine.
Now spend a little time, this is where it came from.
The tag on it, this one has no name and no tag.
The image id we've mentioned before.
I wanna mention this size here.
Because these images share a great deal
of their underlying data, you don't sum up the sizes here
to get the total amount of space that Docker is using.
In this case all of these 122 megabyte images here
are actually the same one 122 megabytes
with different names on them.
Docker is much more space efficient that it would look like
just from looking at this list,
so don't get scared by that.
So we've mentioned tagging images to give them names.
I just wanted to mention that you don't have
to manually tag images.
When you do Docker commit, it will tag the images for you.
So you can say docker commit, my container id name.
If I do docker ps-l to look at my most recently
stocked container, and let me put on my
usual format argument here.
I can say docker commit,
I can use this id, cut, paste.
And I would like to give it the name my-image-14.
Now when I run Docker images again
I can see that it made a new image called my-image-14,
with the tag latest because I didn't specify a tag.
If I run that again and say my-image-14:version2.1
I've made another image that is my-image-14
with a different tag.
See the version number comes after the tag
and if you don't specify it, it just defaults to latest.
All right, so the full structure of these names
is the registry or the server that you get this
image from, the port number on that server.
Your organization name, the image name
and then a version tag.
You can leave out the parts you don't need.
Usually organization/name is enough
when you're tagging your images
unless you're using custom repro with custom ports
and you have version tags.
So images come from docker pull which is actually
fun automatically for you by docker run.
It's available as a separate command
if you need to do offline work
and you wanna pull some images in advance.
This doesn't come up that often.
The opposite of docker pull is docker push
which we'll cover soon.
Now images can build up very quickly.
One time I cleared out all the old images
on a server and freed up 500 gigabytes.
So if you're not careful they can build up.
The docker rmi command for remove image
takes the image name and the tag
and just removes it from you system.
In this case I'm gonna list my images,
and I've got a bunch of 'em here.
I don't need all these.
Docker rmi, let's start by removing this one,
the completely unnamed, unknown image
that I'm never gonna use again.
I don't even remember what it is.
All right, now I don't need this my-image.
Copy, docker rmi,
paste, my-image.
Now deleting all of these my-images by hand,
that's gonna get a little tedious.