Create a base image | Docker image file
MostDockerfilesstartfromaparentimage.Ifyouneedtocompletelycontrolthecontentsofyourimage,youmightneedtocreateabaseimageinstead.Here’sthedifference:Aparentimage[1]istheimagethatyourimageisbasedon.ItreferstothecontentsoftheFROMdirectiveintheDockerfile.EachsubsequentdeclarationintheDockerfilemodifiesthisparentimage.MostDockerfilesstartfromaparentimage,ratherthanabaseimage.However,thetermsaresometimesusedinterchangeably.Abaseimage[2]hasFROMscratchinitsDockerfile.Thistopicshowsyouseveralwaystocrea...
Most Dockerfiles start from a parent image. If you need to completely control the contents of your image, you might need to create a base image instead. Here’s the difference:
A parent image[1] is the image that your image is based on. It refers to the contents of the FROM directive in the Dockerfile. Each subsequent declaration in the Dockerfile modifies this parent image. Most Dockerfiles start from a parent image, rather than a base image. However, the terms are sometimes used interchangeably.
A base image[2] has FROM scratch in its Dockerfile.
This topic shows you several ways to create a base image. The specific process will depend heavily on the Linux distribution you want to package. We have some examples below, and you are encouraged to submit pull requests to contribute new ones.
Create a full image using tarIn general, start with a working machine that is running the distribution you’d like to p...