Images

Know about Docker images and ways to create images using Dockerfile.

What are images?

Images are blueprints that contain instructions for creating Docker containers. Containers are running instances of an image.

What is Dockerfile?

A Dockerfile is a file that contains instructions for building an image. Fortunately, lots of pre-created Docker images are available for us to use. However, if we want to customize our image according to our own needs, we can do that by creating a new Dockerfile. It automates the process of Docker image creation.

To understand it, think of your favorite beverage. A popular example is a tea. Typical instructions to make tea are as follows:

  1. Boil a cup of water.
  2. Add one spoon of tea leaves.
  3. Add one spoon of sugar.
  4. Add a cup of milk.
  5. Keep boiling for five minutes.
  6. Add ginger, and boil for two more minutes.

Similarly, the Dockerfile contains pieces of instructions used to create an image. ...