To create a
docker container,
users must write a
dockerfile,
and every Dockerfile
starts
with a
base image
.
So what is the importance of the
base image
in
dockerfile
?
A base image is the
parent image
that your image is based on.
The user needs to define the base image on
top
of the
Dockerfile
.
A base image has
FROM scratch
in its Dockerfile.
FROM alpine:3.14
When choosing a docker base image, the first thumb rule is that the
image size should be smaller
.
The other important thing to consider is that the base image should contain
all the necessary libraries
the user is going to use.
In most cases, people either choose either
alpine or Debian
as a base image.
If the user does not want any pre-installed packages, then he can also use
scratch
as a base image.
Click to learn more