1. Home
  2. Training Library
  3. Containers
  4. Courses
  5. Getting started with Docker

Working with Docker Images


What is Docker?
Start course

It's hardly an exaggeration to say that there hasn't been an innovation in app development and deployment over the past year or two that's been bigger than Docker. The open source platform for building, shipping, and running distributed applications in isolated virtual containers has literally changed the very fabric of the cloud. Thanks to Docker, software developers can reliably create and deploy applications with all their dependencies in Docker images that can be made available to anybody, and launched in seconds.

This introductory course, crafted by the expert Linux System Administrator David Clinton, will teach you everything you need to know to get started with Docker: What is the LXC software that it's built upon? How is it different from traditional virtualization technologies? How you can install and run it on your machine? By the end of this course, you'll have all the basic tools you'll need to run simple Docker applications.

Who should take this course

Being an introductory course, no previous knowledge of the software is needed. Nevertheless, you will definitely need at least some experience with the Linux Command Line Interface. Also, some familiarity with the Linux file system, kernel and networking basics might came in handy for some lectures.

Do you have questions on this course? Contact our cloud experts in our community forum.


Hi and welcome to CloudAcademy.com's video series on Docker, the development oriented virtualization service. In this video, we're going to explore Docker Images, how we acquire, use, manipulate and share Docker containers. Images of the operating system packages that effectively do all the work in virtualization. Let's see which images are currently available on my system.

List of available Docker Images

We'll type "sudo docker images". Sudo because any actions run in the Docker environment must be run with root privileges. Docker, to tell the system that we are using the Docker environment now and images will list the available images. The first column on the left is repository, that is, you might say the general family of Docker images. Debian is a family. There are many released versions of Debian.

You'll see three quarters of the way down, there is one instance of Ubuntu. That obviously is a related, but a different, family and there are many versions and releases available for Ubuntu also.

The second column is tag, that might be the title or the specific iteration of the repository, any particular repository.

The third column is Image ID, that is the hex code that specifically identifies this particular image. This will become much more important soon.

How to preload Docker Images

In order to pre-load an image so that running it doesn't require all the extra time and resources of downloading the whole image, you could pre-load it first, before you start, using "sudo docker pull" to pull an image from the online repositories, space and then the name of the image you'd like to download, perhaps CentOS or Fedora or Ubuntu, if that's not already installed on your system.

How to choose? Where do you find the thousands and thousands of available free Docker images that you can download? One place to look is hub.docker.com, that is the web-based interface to the vast repositories of Docker images.

However, you can also access and search through these available Docker images from the command line. Type "sudo docker search", predictably. Let's search for any image that has Apache, the web server software, included. There are a lot of different Docker images that include Apache and reading through all those takes a fair amount of work. If your a half decent system administrator, you're probably quite lazy.

All good system administrators are lazy. Therefore, you can narrow down your search and get through this list quite a bit more quickly using grep, to display only those entries with Apache that also have another search string. In our case, let's try Ubuntu. So we're looking for an image that's built on the Ubuntu base, that also has Apache installed.

That's a lot better, only a dozen or so choices. Let's take just out of the crowd, I've no idea which is closer to what we really want but let's go with armada/ubuntu-apache. This would seem to be an image of Ubuntu, created by someone named Armada or a company perhaps named Armada, which includes Apache.

How are we going to get this? "sudo docker pull armada/ubuntu-apache". It's going to take some time. We'll skip some of the details but the system is currently pulling the repository Armada Ubuntu-Apache.

That seems to be complete. Let's check to make sure that we have in fact downloaded and installed our Armada/Ubuntu-Apache by running it. Let's "sudo docker run -i -t armada/ubuntu apache" and we'll run in this container. We will start a shell session within the container using bash. Use my host password and we seem to be in. Let's right away, "sudo apt-get update" to make sure that all the repository packages are known to our instance.

How to create your own Docker images

Now, let's make a change. Let's do something to this container that will make it different than it was before and allow us to demonstrate how we can commit a changed container and create with that a new image. So let's "sudo apt-get install", let's install a new package shorewall, which is a very nice IP rules-based firewall package.

We completed the download and installation. Let's exit and at the same time, shut down the image. Let's get the image ID of our new container, sudo docker psa, because remember we want to see the Docker images that are currently running and those that aren't running now because our new image is not currently running.

The image ID for our new version of Armada Ubuntu is 975 etc. Let's now commit this image, "sudo docker commit -a=john smith", who is the fictional author of this image. We'll add the image ID and then give it a name, let's say, shorewall-apache. We can really use any name we like because it's a locally saved image but if we were saving this and pushing it up to Docker's online repository, we would have to conform to their naming rules.

The image seems to have been saved and we have committed our first Docker image. Just to confirm that in fact our image has been created, let's "sudo docker images". The very first image in the list is Shorewall Apache, with a new image ID of E69856 etc.

About the Author
David Clinton
Linux SysAdmin
Learning Paths

David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.

Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.

Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.

His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.