Roadmap › Docker & Containers › Module: Core Concepts
Lessons in this course (8)
1. Images, containers, layers and registries
Basic★ Must knowLesson 1 of 8
- Image — read-only template made of stacked layers (each Dockerfile instruction adds one). Identified by
repository:tag(e.g.myacr.azurecr.io/shop-api:1.4.2) and an immutable digest (@sha256:...). - Container — image + a thin writable layer + runtime config (env vars, ports, mounts). Changes in the writable layer are lost when the container is removed.
- Layer caching — unchanged layers are reused between builds and shared between images on disk (copy-on-write via the overlay2 storage driver).
- Registry — stores images; repository — one image name with many tags.
bash
docker pull mcr.microsoft.com/dotnet/aspnet:10.0
docker images
docker run -d --name web -p 8080:8080 -e ASPNETCORE_ENVIRONMENT=Development shop-api:dev
docker ps -a
docker logs -f web
docker exec -it web /bin/sh # shell inside (if the image has one)
docker stop web && docker rm web
docker image prune -a # remove unused images
docker system df # disk usageInterview tip: never use the
latesttag in production — use immutable version tags or digests so deployments are reproducible.