Ref: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44151202
YouTube: https://www.youtube.com/watch?v=BKNnQPyqJvc
DEMO: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44151206
DEMO-YouTube: https://www.youtube.com/watch?v=oW97xGNYNkM
DEMO-GitHub: https://github.com/acantril/docker-fundamentals/blob/main/Working-with-existing-docker-images.md
Docker Images
- đź”§Â Immutable, read-only templates
- changing an image implies creating a new image
- Structure: collection of independent file system layers
- Differential layers → each layer contains only the differences from layer below
- âť—Â Layers are independent and can be reused
docker pull
only pulls missing layers → avoids unnecessary uploads & downloads
- Image is presented as a single file to the outside, even if inside there's layers
- Docker Images Diagram
Docker Containers
- đź”§Â An instance of a Docker image which can run
- Containers add a writable layer to the image template
- Any data changes that happen at runtime are stored in this layer
- image layers remain unaltered during runtime
- This layer implies a performance hit when container runs
- âť—Â Writable layer is linked to container's lifecycle
- persists when container is stopped, but not when it's deleted
- The union file system overlaps all layers as a single entity
- all data is tightly coupled with the host → data cannot be easily moved
- Docker Containers Diagram
Additional useful/basic commands
docker inspect <ID>
- show metadata of Docker object
- Docker object can be image, container, volume…