A human-readable text file which contains all the instructions to build the image. You have to place the Dockerfile along with all associated libraries and dependencies in a folder to build the image.
A standalone, executable file used to create a container. It is composed of image layers to keep the file size small. Each layer represents a change made to the image. The layers are read-only and can be shared among multiple containers. Docker images are immutable, which means they can’t be modified once created. If changes need to be made to an image, you must create a new image with the desired modifications.
A self-contained, runnable software application or service. If you start an image, you have a running container of the image. You can have many running containers of the same image. You create and destroy containers over an application’s lifecycle. The Docker container, being an image instance, also contains layers. However, it has an additional writable layer, known as the container layer, on top. The container layer allows read-write access. It also enables any changes made within the container to be isolated from other containers based on the same image. Thus, containers are mutable and allow modifications during runtime. Changes made within a container are isolated to that particular container and don’t affect its associated image.
| Docker image | |
|---|---|
| What is it? | A reusable, shareable file used to create containers. |
| Created from | Software code, dependencies, libraries, and a Dockerfile. |
| Composition | Read-only layers. |
| Mutability | Immutable. If there are changes, you have to build a new file. |
| When to use | To store application configuration details as a template. |
ps: docker psexec: docker exec CONTAINER du -h
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]