Every docker run
command, or every RUN
command inside a Dockerfile, creates a container. If the container is no longer running it can still be seen wit
An image is a snapshot of file system and dependencies or a specific set of directories of a particular application/software. By snapshot I mean, a copy of just those files which are required to run that piece of software (for example mysql, redis etc.) with basic configurations in a container environment.
When you create a container using an image, a small section of resources from your system are isolated with the help of namespacing and cgroups, and then the files inside the image are copied in this isolated environment of resources.
Hence, containers only take disk space. If there are unused containers, you should remove them, but not the image as they always reusable.