What is a Docker Image?
A Docker image is a read-only template containing everything needed to run an application โ code, runtime, libraries, environment variables, and configuration files.
Image Structure
An image is made of LAYERS stacked on top of each other:
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Application โ โ Layer 4: Your code
โโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependencies (npm) โ โ Layer 3: npm install
โโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Node.js Runtime โ โ Layer 2: apt-get install nodejs
โโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Ubuntu Base โ โ Layer 1: FROM ubuntu
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Each layer is cached โ if nothing changes, Docker reuses it
This makes builds FAST after the first time
Image vs Container
Registries