What is Docker exactly?
Docker is a software platform (collection of software) that lets you package your own software into standardized and portable units called containers that include everything the software needs to run including:
- Libraries (e.g., NPM/Composer/Nuget/Maven packages)
- System tools (e.g., CURL, ImageMagick)
- Source code (e.g., your Symfony code, Rails code, etc)
- Runtime (e.g., JVM, PHP-FPM, Node.js).
What is the big deal about containers?
By packaging your software into containers, you benefit from the following:
- Avoid vendor lock-in. You can easily move your containers between different servers/environments (e.g., from on-premises Kubernetes to AWC ECS, Azure ACI, Google GKE, etc).
- Make deployments deployment easier. Once you package your software into portable containers, moving them between local/staging/production environments becomes easy compared to manually setting up and configuring each environment.
- Horizontally scaling becomes a matter of spinning up more instances of the same container.
- Save money by utilizing server resources more efficiently (e.g., running multiple applications on the same host server). Containers are much more efficient than virtual machines.
- Set up consistent development environments using a single command like
docker-compose upto avoid common issues like mismatches between runtimes (e.g., Node.js 10 vs Node.js 10.2), languages (e.g., PHP 8.0 vs PHP 8.1), and other dependencies (e.g., MySQL version or whether some system tool like
- Save development/DevOps time by making use of ready-made images in the vast Docker community.
Components of Docker
- Docker Engine – The daemon that actually runs, stops and manages Docker containers.
- Docker CLI – CLI interface to the Docker API.
- Docker API – REST API that lets you manage your Docker containers.
- Docker Hub – repositories of community Docker images.
- Docker is like an operating system for containers. You install Docker on each server operating system and use its CLI to build, start, or stop containers.
- Docker was first started in 2013.