Tethys Platform
Table Of Contents
Table Of Contents

Docker Primer

Last Updated: November 2021

This guide provides an overview of Docker and the key concepts needed to use it effectively. For more detailed descriptions of the concepts in this guide, please review the articles in the footnotes.

Shipping Analogy

Prior to the advent of the shipping container, shipping goods to different parts of the world was a logistical nightmare. Goods came in all different sizes of containers and arranging them on ships was haphazard. The same was true with trains and trucks when it came time to ship them overland. The result was shipping was expensive and slow and goods were often misplaced, broken, or rotted because of the delays.

The shipping container streamlined the shipping process because of its standard size. Merchants could put whatever they wanted in a shipping container. It didn't matter to the shipping companies if they were shipping bananas or cars. Loading the ship became a simple operation of stacking boxes and loading was reduced from days and weeks to hours. In addition containers could be easily transferred to trucks or trains for overland shipping. 1


Like shipping containers, Docker containers have streamlined and standardized the way applications are deployed on the web. Docker describes a container as "a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another." 2 Containers leverage features of Linux that make them lighter weight than virtual machines. The applications inside containers are isolated from the server they are running on, which makes them more secure.

Container Images

Containers are running instances of container images, which are "lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings." 2 A container image is a read-only template or blueprint for a container. 3 Container images can be exported as archives (i.e. .tar) and they can be easily transferred to a server for deployment.

Containers vs. Virtual Machines

Containers and virtual machines have some similar properties, however there are important differences in how they function that make containers more portable and efficient. The primary difference is that containers virtualize the operating system whereas virtual machines virtualize the hardware (see Figure 1). This means that containers share the core OS components (called the kernel), which makes them an order of magnitude smaller than virtual machines (container images are usually tens of MBs vs. virtual machine images that are tens of GBs). Any given server will be able to run many more containers than than virtual machines. 2

Illustration of the difference between containers and virtual machines.

Figure 1: Illustration of the difference between containers and virtual machines. 2


A Dockerfile is a text document that contains the instructions for building a container image. It can be thought of as a list of commands that a user would call on the commandline to install an application on a server. The Dockerfile spec includes instructions for running commands, adding files to the image, setting environment variables, and defining the command that should be run when the container starts. 4

Docker Deamon and Client

The Docker daemon is the application that does the work of building container images and running containers from images. You interact with the Docker daemon using the Docker client, which is a commandline program. 5 When you run a command like docker build with the Docker client it passes the instruction to the Docker daemon, which performs the build operation. 3

Docker Registries

A Docker Registry is a database for Docker images. The command docker pull is used to download images from registries and the command docker push is used to upload images to a registry. You can host your own registry 6, but most images are hosted on Docker Hub.

Docker Hub

Docker Hub is a public Docker registry maintained by Docker. In fact, it is the default registry that the Docker daemon uses when you attempt to pull a container image. Docker Hub hosts over 100,000 container images, including official images for many Linux distributions (e.g.: Debian, Ubuntu, and CentOS) and application components (e.g.: PostgreSQL, NGINX, and Python). Docker Hub can also be used to publish your own Docker images and it is free to do so for individuals, education, open source projects, and small businesses. 7

Screenshot of Docker Hub.

Figure 2: Screenshot of Docker Hub.



See Docker and Shipping Containers: An Imperfect Analogy


See What is a container? | Docker


See Docker overview | Docker Documentation


See Dockerfile reference | Docker Documentation


See Use the Docker command line | Docker Documentation


See Docker Registry | Docker Documentation


See Docker Pricing & Monthly Plan Details | Docker