Friday, February 22, 2019

Docker

A container can be thought of as a really lightweight VM.

Containers are much smaller than VMs by default — a container doesn't contain a full operating system, whereas a VM does. Containers thus require a lot less in terms of processing power in order to run — they tend to be mere megabytes in size and take just seconds to start.

VMs tend to be gigabytes in size and can take minutes to start, because operating systems are big! Containers make use of libraries and packages on the host operating system in order to access resources. They then make use of their own libraries and packages in order to emulate separate operating systems, as needed, instead of installing unnecessary bloat. For example, you could run an Ubuntu image on your Windows machine without needing to install Ubuntu.

The smallness of containers is, of course, really great when it comes to scaling applications. If we were hosting recommend_service as a VM and had a spike in traffic, users would just have to deal with some extra latency and perhaps some errors while we brought extra VMs online. On the other hand, if we were using containers, we would be able to bring them online much faster, and potentially even keep extra instances running, in case of spikes, because containers are cheap.

Docker is the de facto industry standard container platform.

Docker allows the creation of images. Images are instantiated to create containers (if you are familiar with object orientated programming, then images are like classes, and containers are like objects). In this section, we will create and run a container, and the container will contain a service we wish to deploy.

No comments:

Followers

Link