Skip to content

Useful Terms for Discussing and Understanding Docker

DeeDeeG edited this page Dec 21, 2019 · 4 revisions

Here are some useful terms to know, in order to understand and discuss Docker clearly and accurately.

  • Dockerfile
    • A set of instructions or commands, written in a text document with a specific format. Docker will read each command or instruction from the Dockerfile in order, creating a layer for each given command or instruction. As mentioned below, each layer contains the results of running the command, or following the instruction, from the Dockerfile. The result of running all the commands or instructions from a Dockerfile is an image.
  • Layer
    • Layers are the result of instructions or commands from the Dockerfile. Each layer includes a set of changes laid over the filesystem snapshot from an existing layer or image. (The base layer, from the first instruction or command in the first Dockerfile, creates an initial filesystem snapshot. Other layers can be based on top of this base layer.)
  • Image
    • An "immutable" (non-changeable) snapshot of a filesystem, made up of layers. An image is "tagged" (given a name and hexadecimal ID number) after all the commands and instructions in a Dockerfile are complete.
  • Container
    • A running instance of Docker, consisting of an image and its associated environment variables and configurations.
  • Volume
    • An area of managed files, separate from of the layers/images system. This area of files is managed to some extent by Docker, and can be created by the docker compose program. Changes to files do not "stack" on top of past changes, and cannot be rewinded; changes to files simply overwrite the old files within the volume's file area.
      • (Notably for this project, Refuge Restrooms creates/stores its database within a volume when running from Docker. Refuge Restrooms only uses Docker during development and testing, not in final production; final production is run from a standard Heroku environment configured for Ruby and NodeJS.
  • compose
    • Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.

    • Refuge Restrooms generally uses docker compose rather than running the many, complex docker commands it would take to achieve the same result.

Bonus terms for greater understanding:

  • Union file system
    • A way for a computer to store files in terms of layers. A base layer contains an initial snapshot of the files. Further layers record exact changes to their parent layer. When all the layers are combined, a final snapshot is produced. Looking back: Any layer can be joined with the layers below it to create a full snapshot of all the files as they appeared in that specific layer (in the moment in time that the uppermost layer was created). Docker uses this to store and operate on arbitrarily many full snapshots, some of which record only small changes, without having to store separate, full-sized copies of all the files on disk after every change. This comes with some performance overhead up front, but uses less space on disk for the same amount of information. (It is also usually much faster than copying an entire large image would be, for example, in order to record only a small change.)
    • See also: Copy-on-write
  • Docker Toolbox
    • "Docker Toolbox" is a version of Docker that runs in VirtualBox. It is a bit slower than running Docker outside of VirtualBox, but on some older versions of Windows/macOS, or on some computer hardware, Docker will only run in VirtualBox (via Docker Toolbox). Native solutions are "Docker Desktop for Windows" and "Docker Desktop for Mac" for newer computers used with newer operating systems. Linux users can use "Docker CE" natively, outside of Virtualbox.