Introduction
Overview
Teaching: 5 min
Exercises: 5 minQuestions
What are containers?
Objectives
Understand the basics of images and containers.
Documentation
The official Docker documentation and tutorial can be found on the Docker website. It is quite thorough and useful. It is an excellent guide that should be routinely visited, but the emphasis of this introduction is on using Docker, not how Docker itself works.
A note up front, Docker has very similar syntax to Git and Linux, so if you are familiar with the command line tools for them then most of Docker should seem somewhat natural (though you should still read the docs!).
Docker Images and Containers
It is still important to know what Docker is and what the components of it are. Docker images are executables that bundle together all necessary components for an application or an environment. Docker containers are the runtime instances of images — they are images with a state and act as native Linux processes.
Importantly, containers share the host machine’s OS system kernel and so don’t require an OS per application. As discrete processes containers take up only as much memory as necessary, making them very lightweight and fast to spin up to run.
It is also worth noting that as images are executables that produce containers, the same image can create multiple container instances that are running simultaneously as different processes. If you think about other executables that can be run in multiple processes on your machine this is perhaps not too surprising.
Key Points
Images are series of zip files that act as templates for containers.
Containers are runtime instantiation of images — images with state and are native processes.