What Is a Dockerfile and What Is a Docker Image?

Question / Problem scenario
You know what a Docker container is.  What is a Dockerfile and what is a Docker image?

Answer to What is a Dockerfile?
"Dockerfiles are used to define how a container should look at build time, but they do not manage the container's ongoing state, and cannot be used to manage the Docker host system." (Page 5 of Docker Up & Running by Matthias & Kane, O'Reilly Press, 2015.)

It is "a manifest that describes how a Docker image is built" according to page 26 of Docker Cookbook by Sebastien Goasguen, published by O'Reilly Press 2016.

"Docker can build images automatically by reading the instructions from a Dockerfile." taken from Docker.com.

Answer to What is a Docker image?

A file that is necessary for launching a Docker container.   "Docker images consist of one or more filesystem layers and some important metadata that represent all the files required to run a Dockerized application."
(Page 26 of Docker Up & Running by Matthias & Kane, O'Reilly Press, 2015.)

Each instruction in a Dockerfile "creates a new Docker image layer." (Page 43 of Docker Up & Running by Matthias & Kane, O'Reilly Press, 2015.)

A Dockerfile is needed to create a Docker image.  A Docker image is needed to create a Docker container.

Leave a comment

Your email address will not be published.