What is the difference between Docker container and Docker image?

Today I learned the difference between image and container in Docker. An image is a template that can be used to create a container while container is the instances of said Docker images. The container is the one that runs your application.

To explain it in cake term, image is the recipe of the cake and container is the cake itself. You can create multiple cakes based on the same recipe.

To see all the images available, you can run the following:

$~ docker images

and to see the container that’s currently running, you can run:

$~ docker ps

or if you want to see the list of available containers, run:

$~ docker ps -a

That’s it. 🎂

References:

  1. https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container