Docker in Simple Terms - Introduction
Docker is a widely used tool allowing us to build, ship and run applications in isolated virtual environments, as if they were on separate machines. This article is an introduction to Docker.
Introduction
Docker is a widely used tool allowing us to build, ship and run applications in isolated virtual environments, as if they were on separate machines.
The aforementioned technology is called containerization and is the cornerstone of modern software development, akin to virtual machines.
In this article, we'll talk about:
- Basic components of Docker, such as images, containers, networking, storage.
- Tools and services built around Docker.
In the future parts, we'll guide you through creating Docker Images from ground up using Dockerfiles and Docker Compose, and explain networks and storage in-depth - so stay tuned!
Images & Containers
In this section, we'll explain Docker Images and Containers in-depth and how they work.
Images
Docker Image is a snapshot of one or more applications, along with their dependencies, which can include application code, runtime environment, libraries, dependencies, configuration files or even an operating system.
While Docker Images are read-only by default, you can merge multiple images into one, or pull an image, modify it to your needs, and then create another image from it.
Images are designed to be portable, so they can be used to run the same application on any system that supports Docker. This makes it easy to move applications between development, testing, and production environments, or to share applications with others.
Containers
A Docker Container is an independent instance of a Docker Image, and a single image can have multiple containers running with the same or different configuration. Think of images as stateless templates and containers as stateful instances of these images.
Networks
Docker Networks allow containers to communicate with each other, either on the same host or across multiple host machines.
There are multiple types of network drivers that differ in how they are consumed and what capabilities they have:
- Bridge: the default network driver that allows containers to communicate with each other on the same host machine.
- Host: connects containers directly to the host network; useful for performance-intensive applications.
- Overlay: used for creating multi-host networks; allows containers to communicate with each other across multiple hosts.
- Macvlan: connects containers directly to a physical network, allowing them to appear as individual network devices.
- None: self-explanatory; disables networking completely for a container.
Each network driver provides a different level of isolation, performance and capabilities.
Each container connected to the network is accessible either through assigned IP address or alias (hostname).
Overall, Docker Networks provide a powerful way to manage communication between containers, allowing you to build complex, multi-container applications that can scale horizontally across multiple hosts.
Storage
Docker Storage enables containers to manage and persist data. Like Docker Networks, there are several types of storage drivers available, each with it's own capabilities and performance characteristics:
- Overlay: provides an efficient way to store and manage multiple layers of data.
- Aufs: a driver similar to Overlay, but with different performance and capabilities.
- Device Mapper: used for creating dedicated volumes, allowing containers to have their own disk space.
- Btrfs: provides an alternative to Overlay for managing multiple layers of data.
In addition to these storage drivers, Docker also supports external storage drivers that can be used to manage data on external storage systems. This allows for bi-directional sharing of data between the host and container.
Tools & Services
The following section describes tools and services designed to consume or further expand Docker's capabilities.
Docker Hub
A cloud-based registry service that allows developers to store and share their Docker Images. Currently the biggest source of the official Docker Images for things like: Node, DotNet, Postgres, Redis and more.
Docker Desktop
An application for Windows and Mac that allows users to easily install and run Docker Engine and Docker Compose, along with other tools and services, providing an integrated development environment for builiding and deploying containerized applications.
Docker Compose
A tool used for defining and running multi-container Docker applications.
Docker Swarm
A native clustering and orchestration tool for Docker, used for managing multiple Docker hosts and deploying services across a cluster.
Kubernetes
An open-source container orchestration platform that can be used with Docker to manage containerized applications.
Docker Machine
A tool used for creating and managing docker hosts on local or remote machines.
Docker Registry
A standalone server that can be used to store and distribute Docker Images. More on that here: How to Host Your Own Docker Registry on Linux.
Docker Cloud
A hosted service that provides a centralized platform for managing Docker-based applications. This includes hosting, scaling and deployment of containers.
Final Thoughts
In summary, Docker is a popular, simple, and powerful tool with many features. Its robustness can be overwhelming for newcomers, but each feature has enough boilerplate to make it a painless experience. Docker's power lies in the simplicity of its features, which has contributed to its widespread adoption in modern software development.
This concludes Part I of these series.