What is difference between image and container in docker?

Images themselves are never started, they are never “running”. Containers use the image to begin their lifecycle (they start with whatever file structures, applications, libraries, etc. that are within the base image). They will then add their “layer” to track all of the changes that are made after that initial start from base.

Each time you start a container from a base image, you are effectively “starting over”, meaning that changes made to a container do not carry over to the base image, and thus are not inherited by other containers. However, changes made within a container are saved so that if you restart a stopped container, the changes made when it was running will still be available (since they are captured in that specific container’s filesystem layer).