A Dockerfile is a text document that contains a set of instructions.

The Docker image will be built from the set of instructions written in the dockerfile.

Dockerhub is the place where you will find many officials as well as images developed by developers/open source contributors.

But why a user needs to create a Dockerfile if there are already many images available?

The simplest answer is in most cases the user needs to create a dockerfile if existing images do not fulfil your current requirement.

The general syntax of Dockerfile follows the below pattern

# Comment INSTRUCTION arguments

INSTRUCTION represents a keyword in the dockerfile. Instructions perform specific tasks based on the order in which it appears in the Dockerfile.

Some of the most widely used INSTRUCTIONS are:


Below is the sample dockerfile

FROM alpine MAINTAINER naiveskill ENTRYPOINT ["/bin/head"] CMD ["/etc/pam.d"]