What is the difference between Docker container and Docker image?
• 1 min read
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 imagesand to see the container that's currently running, you can run:
$~ docker psor if you want to see the list of available containers, run:
$~ docker ps -aThat's it. 🎂
References:
- https://stackoverflow.com/questions/23735149/what-is-the-difference-between-a-docker-image-and-a-container