docker build
Docker images can be built in two ways. One way is to author a Dockerfile with instructions to prepare the image and use the docker build
command to create an image. The second way, which will be discussed in the following section, is to create a container using a base OS image such as windowsservercore
, connect to the container using an interactive command line such as PowerShell or Windows Command Prompt, customize the container using automation scripts such as PowerShell or any other tools (since Windows Server Core does not have a UI any customization can only be done via scripts) and then convert to an image using the docker commit
command. In this section, we will be learning how to create an image using the docker build
command.
docker build
is used to create an image using a Dockerfile; the two main elements for creating an image are the Dockerfile and a build context. Build context is the folder and its contents are specified in the Path
or URL
option. URL
can also be...