Home | Virtualisation | Getting Started with Docker
Getting Started with Docker

Getting Started with Docker

5 Flares Twitter 0 Facebook 0 Google+ 5 StumbleUpon 0 Buffer 0 LinkedIn 0 Filament.io 5 Flares ×

In my previous post, I talked about how Docker fits in with workload virtualisation.  In this post, I’ll look at getting started with Docker itself.


In this post I’ll look at the basics of installing Docker and creating a container.  I’ll reference the CentOS distribution initially, with more added as I validate and test them; this installation is based on CentOS 6.5, which is the minimum version required for Docker support.

The Docker packages for CentOS aren’t available through the standard yum repo libraries but are available through EPEL (Extra Packages for Enterprise Linux) repository.  The first step is to add the EPEL repository:


Next we can install the Docker packages using yum:


And here are the results of the installation:


The installation also installed dependent packages for LXC (Linux Containers), which are used by Docker up to version 1.0.

Now we can start the Docker service and set it to start after each reboot with the following two commands:


At this point we can check the installation is successful and start running containers.  All commands start with the docker keyword; here we check the version and systemwide information.  Run the docker command without arguments to get a list of command options.


Running Containers

In order to start up a container, we need a Docker image. Images are held in repositories, which are divided into Official Repositories and Private Repositories. In this instance we’ll use the official repository for CentOS.

There are two ways to “pull” or download an image.  We can do it either explicitly with the pull command or start a container with an image that isn’t already downloaded.  In this instance, I’ve downloaded the whole of the CentOS repository.


Docker images are stored in a number of folders in the /var/lib/docker/, however we’ll save the details of that for another time. Now we can start a container. In this instance we’ll run the latest CentOS image:


Here I’ve started a container, with the -i and -t switches which make the container interactive by creating a persistent stdin and attaching a pseudo terminal. The container runs the /bin/bash command, which we can see is the only process running apart from the ps command then run to display running processes. Exiting the shell closes the container (as the shell was the highest process running), however a container can be exited without terminating it using CTRL-P then CTRL-Q. The following screenshot shows the docker ps command used to list running containers.  Each container is tracked by a GUID and by default assigned a two word name, although this can be specified by the user.


This post provides a starting point for getting Docker up and running. Future posts will look at networking, how Docker images and containers are stored on the host and of course doing something useful!


Related Links

Comments are always welcome; please indicate if you work for a vendor as it’s only fair.  If you have any related links of interest, please feel free to add them as a comment for consideration.  

Subscribe to the newsletter! – simply follow this link and enter your basic details (email addresses not shared with any other site).

Copyright (c) 2009-2014 – Chris M Evans, first published on http://blog.architecting.it, do not reproduce without permission.

About Chris M Evans

Chris M Evans has worked in the technology industry since 1987, starting as a systems programmer on the IBM mainframe platform, while retaining an interest in storage. After working abroad, he co-founded an Internet-based music distribution company during the .com era, returning to consultancy in the new millennium. In 2009 Chris co-founded Langton Blue Ltd (www.langtonblue.com), a boutique consultancy firm focused on delivering business benefit through efficient technology deployments. Chris writes a popular blog at http://blog.architecting.it, attends many conferences and invitation-only events and can be found providing regular industry contributions through Twitter (@chrismevans) and other social media outlets.
  • Johan Guldmyr

    Great post! Looking forward to the next!

5 Flares Twitter 0 Facebook 0 Google+ 5 StumbleUpon 0 Buffer 0 LinkedIn 0 Filament.io 5 Flares ×