Before actually learning docker we have to understand the difference between containers and images. People still get confused between them and unable to explain clearly if someone ask, so let me clarify the difference between these two.
In one line "Docker images are read-only templates used to build containers. Containers are deployed instances created from those templates."
Container is a running environment for an image. Theoretically container is a part of container runtime.
Images are just templates, you cannot start or run them. What you can do is use that template as a base to build a container.
Container has application image that runs the application like redis, postgres, chef, ubuntu etc and also file system where it can save log file and configuration files like environment variables.
Containers are the organizational units and one of the Docker basics concepts. When we build an image and start running it; we are running in a container.
When you run a containerized environment, you essentially create a read-write copy of that filesystem (docker image) inside the container. This adds a container layer which allows modifications of the entire copy of the image.
The container analogy is used because of the portability of the software we have running in our container. We can move it, in other words, “ship” the software, modify, manage, create, or get rid of it, destroy it, just as cargo ships can do with real containers
When talking about the difference between images and containers, it isn’t fair to contrast them as opposing entities. Both elements are closely related and are part of a system defined by the Docker platform.