Building an image with Docker Engine
They say the longest journey begins with a single step. In this case, an application begins with a single image. More often than not, existing images will not be perfect fits. This will certainly be the case if you are deploying your own services.
It all starts with a Dockerfile
. This file provides detailed instructions to Docker for building an image. There are a lot of things that can be done in a Dockerfile
. Specific operating system packages or language libraries can be installed; configuration files can be put into place; and a default command can be set. It is best to base a new image for an application off an official image, when possible. For example, an application written in Ruby should be based off of the official ruby
image. A full reference of the Dockerfile
directives can be found at
https://docs.docker.com/engine/reference/builder/
.
Building from a Dockerfile
Back in Chapter 1 , Getting Started with Docker Orchestration, we started with...