Docker 101

This isn’t a “What is Docker?” post; you can find those everywhere, written by people who understand it, and can explain it, much better than I. This is a quick & dirty “get-it-running” primer.

A Docker image consists of a “base layer” (usually a slimmed down version of Linux, or Windows) and software additions/modifications layered on top.

I’ll use Jenkins as a working example. To download the Jenkins image from the Docker store:

docker pull jenkins

To list all the images that exist on the docker host:

docker image ls

To show the various software layers that make up the image (starting with the base image, and subsequent changes layered on top):

docker jenkins history

Now, an image, by itself, isn’t useful until it runs.

To create a new container (an instance) of the jenkins image with a randomly-generated friendly name:

docker run jenkins

At this point, I could point my browser to http://xx.xx.xx.xx:8080 and I’d be browsing the Jenkins DevOps tool!

To list all containers (running or not):

docker container ls -a

In my screenshot, “thirsty_wozniak” was randomly generated.
To stop that container:

docker stop thirsty_wozniak

To start it back up:

docker start thirsty_wozniak

Congratulations, you passed Docker 101.
Docker 102 is taught by a different instructor🙂

Leave a Reply