Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introduction to Docker!
You have completed Introduction to Docker!
Preview
Now that you know the basics of creating Docker images and containers, it probably won't be long before you build up a substantial collection. Let's look at some features Docker has provided to help you manage your images.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
It probably won't be long before you build
up big collections of Docker images and
0:04
containers.
0:09
Let's look at some features Docker's
provided to help you manage them.
0:09
For this part of the course
you'll need this Docker file
0:13
in a supporting script saved in
a directory on your computer.
0:16
See the teacher's notes for
info on retrieving them.
0:20
Let's build an image based
on this Docker file.
0:23
Changing of the directory
where the files are stored.
0:26
We'll use the docker build command again.
0:31
And give it a tag of mongo DB,
so -t mongodb.
0:34
And we'll say to look for
a Docker file in the current directory.
0:41
When we hit Enter, Docker build
will carry out all the instructions
0:44
in the Docker file, and will tag
the resulting image as mongodb latest.
0:49
We can get a list of the images on your
Docker host with the Docker images
1:00
sub-command.
1:05
We'll see the MongoDB image
we've just created in the list,
1:07
with a default tag of latest.
1:11
The output will also include
other info about each image,
1:14
like when it was created, and its size.
1:19
I also see a temp image that we
created earlier in the list.
1:21
We don't need that anymore,
so let's get rid of it.
1:25
We can use the docker rmi subcommand,
which stands for remove image.
1:27
And we pass it the tag of
the image we want to remove, temp.
1:33
At this point we'll get an error if there
are any containers still around that
1:38
are based on this image,
1:42
because the containers won't be able
to start if we remove the image.
1:43
We'll show you how to remove those
containers in the next video so
1:46
that we can remove the image cleanly.
1:50
Be sure to check the teacher's notes for
1:51
links where you can read up on
Docker's image management commands.
1:53
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up