Docker use has grown exponentially since its introduction, but the associated terminology can be confusing for new Docker users, and sometimes even for more experienced Docker users.
Hopefully this post will help you understand some of the most fundamental terms and concepts associated with Docker, followed by a concrete example that show some of the terminology “in action”. Let’s jump right in to some definitions.
Image – A binary file that includes everything needed to run a Docker container, including metadata describing capabilities and dependencies. All images are immutable, but images are comprised of multiple layers, so modifications and additions can be made by adding a layer. Image layering is realized by using union mounting. Common underlying layers can be shared among images in the same Docker Engine. A base operating system layer might be shared by most, or all of the images on a given host. This sharing allows most images to be quite small relative to something like a VM disk image.
Container – A runtime instance of a Docker image. A container is created using the docker run command. Multiple containers can run concurrently using the same Docker image. A container is a lightweight isolation mechanism for processes. Multiple containers can run on a single host with no knowledge of other containers. Containers have no access to the processes, files, or networks of other containers (or standalone processes) on the host.
Registry – A place where images are stored. Images in a registry are typically available for general use. When a container is started, it will pull its required image from a registry. The most obvious example of a registry is Docker Hub, although there are other third party registries like Google Container Registry, Amazon EC2, and Quay. It’s also possible to deploy a private registry of your own (e.g., using Docker Trusted Registry). A registry supports searching for images.
Repository – A set of Docker images. The images in a repository have the same name and provide the same functionality. They may vary by version (e.g., 1.1, 1.2, etc.) or by composition (e.g., one may be based on Ubuntu and another on Alpine Linux). The separate images in a repository are distinguished by their tags. For example, Docker Hub hosts an nginx repository which contains the images: nginx:1.13, nginx:1.12, nginx:1.13-alpine … one or more of the images in a repository may be pushed to a registry.
Tag – Label attached to a Docker image in a repository.
Build – The process of creating an image from a Dockerfile.
Pull – The process of retrieving/obtaining an image from a registry.
Push – The process of delivering/publishing an image to a registry.
Compose – A tool for defining and running multi-container applications. The containers are all defined and configured from data in a single file. All the containers can be started or stopped with a single command.
Dockerfile – A text document that contains the execute commands needed to build a Docker image. An image is produced from a Dockerfile using the docker build command.
Docker Hub – Public registry of Docker images.
Docker Swarm – A native clustering system for Docker, not to be confused with Swarm Mode. This is Docker’s first container orchestration implementation. If you are in doubt about whether to use “swarm” or “swarm mode”, Docker recommends that you try “swarm mode” first.
Swarm Mode – Cluster management and orchestration features integrated into the Docker Engine. This is Docker’s latest implementation of orchestration and cluster management — available in Docker Engine v1.12 and later.
Let’s finish with an example that uses several of the terms we’ve defined. Suppose we wanted to use Joomla to create a website. It turns out that the Docker Hub registry contains a repository for Joomla and also a repository for MariaDB. Since MariaDB is an acceptable database for use with Joomla, we can pull those images from Docker Hub and create a container for each. With just those two containers configured and running, we can have a working instance of Joomla! No software packages need to be downloaded, installed, or configured. Great, right? Docker makes a deployment like this really easy. It gets easier yet if we introduce Compose into the mix. By creating a Compose file that defines and configures both of the containers, we can pull the images and start the containers with a single command.
It just so happens Yipee.io has a Joomla application definition in the public catalog. If you sign up for Yipee.io and download the Joomla model you can run it for yourself. Here are the steps:
- Sign up (it’s free!) and login
- In the “Filter by Application Name” box, type “joomla”
- You should see a single application named joomla under “Public Applications”
- From the application’s menu, choose “Download Compose File”
- Run “JOOMLA_PASSWORD=SomePasswordYouLike docker-compose -f ~/Downloads/joomla-Compose.yml up -d”
- Point your browser to http://localhost
Interested in learning more about Yipee.io? Sign up for free to see how Yipee.io can help your team streamline their development process.