# Demonstration: One Image, Many Independent Containers ## OBSERVE ``` $ docker images | grep alpine alpine 3.19 a1b2c3d4e5f6 2 weeks ago 7.4MB ``` Exactly one `alpine:3.19` image exists locally right now. ## HYPOTHESIS Predict: after running three containers from it, how many images will `docker images` show? ## INSPECT ``` $ docker run -d --name c1 alpine:3.19 sleep 300 $ docker run -d --name c2 alpine:3.19 sleep 300 $ docker run -d --name c3 alpine:3.19 sleep 300 $ docker images | grep alpine alpine 3.19 a1b2c3d4e5f6 2 weeks ago 7.4MB ``` Still exactly one image — confirmed. ## CHANGE ``` $ docker ps --format '{{.Names}}: {{.ID}}' c3: 9f8e7d6c5b4a c2: 3d2c1b0a9f8e c1: 7c6b5a4d3e2f ``` Three DIFFERENT containers, each with its own ID, all created from that same one image. ## VERIFY ``` $ docker rm -f c1 c2 c3 $ docker images | grep alpine alpine 3.19 a1b2c3d4e5f6 2 weeks ago 7.4MB ``` Removing all three containers left the image completely untouched — proving containers and the image they came from have independent lifecycles. ## Instructor Notes **Demo goal:** Make the 1-image-many-containers relationship undeniable by actually counting both before and after, rather than just stating it. **Approximate timing:** 8 minutes live. **Common mistake to watch for:** assuming `docker rm` on a container also removes its image — a good moment to reinforce that images and containers have separate removal commands (`docker rm` for containers, `docker rmi` for images) for exactly this reason.