How it works...

Docker images are a layered format, which allows each layer to be reused between other images. This is to save on space, rather than having 20 instances of NGINX running on Ubuntu with all the system libraries duplicated. Docker will split these instances into layers so that you can have a singular base image, and each change to this is stored as a layer. Our NGINX image looks like this:

Each layer represents a change, and even the base image itself can be made up of multiple layers. Once you have a running container, any changes are then performed as Copy-on-Write (COW); this means the original images are preserved, while also allowing the ability to modify instances based on them.

Our one-line deploy command can be broken down into a number of different parts: