From the course: Docker for Developers: Create and Manage Docker Containers

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Comparing images and containers

Comparing images and containers

- [Instructor] It's easy to confuse images and containers in Docker. They're closely related, but not the same. Let's clear things up with a simple explanation. A docker image is like a recipe. It's a snapshot of everything your app needs to run, including code, dependencies, environment variables and configuration. Think of it as a read-only template. You can share it, version it, and use it to spin up consistent environments every time. A container is what happens when you run that image. It's a live running instance. If the image is the recipe, the container is the finished dish. The finished dish can be made in any kitchen, regardless of the tools available. You can interact with the container, stop it, restart it, or throw it away and start fresh, because you still have the image. Here's a simple analogy. The image is your class definition. The container is the object you create from it. Images are static.…

Contents