Container Image, in modern computer terms, is a set of userland programs (executables, in Unix term), shared libraries and minimum configuration that allows a piece of software to run in a self sustain environment, called Container Runtime.
Modern Container Images and Runtimes are very flexible. You can normally run an Image which is designed under Ubuntu (one of the popular Linux distribution) in Redhat Linux (another one used often commercially), which is very convenient in Linux because there are so many distributions available.
Running a software in Container technology also makes the possibility of a badly designed or configured software adversely affect the whole machine less likely, as it is "contained" it its own environment.
However, you cannot run an Linux Container Image in Windows, nor you can run an Image that is designed for x86 processor (a.k.a. Intel and AMD processors) in a Linux server running ARM processor. This is one of the major difference between container technology and virtualisation. This is also why Container technology, in theory, is faster than Virtualisation technology.
In a way, Container technology shares quite a lot of benefits of Virtualisation technology, without virtualisation's overhead.
Most Container Image maintainers try their best to make their images available in both x86 and ARM hardware, which are the 2 major hardware platform that Linux runs on.
Container Runtimes and Images exist on Windows and in lesser way, other operating systems (such as FreeBSD) as well.
The following are the main advantages of modern Container Technology.
- It makes software easier to setup, because in typical Linux distribution, when you install a software, you will also need to install the dependencies.
- It allows multiple pieces of software that share same computing resources (for example, same IP port) possible to run in the same machine.
- When you delete the software, all its dependencies are safely removed without affecting other softwares in the same machine.
- Modern Container technology also limits the resources (CPU / Memory, for example) that a software can use.
- In a modern microservice architecture with horizontal scaling design, you can run the same Image multiple times and let the system's resource to glow quickly without a long setup time (called provisioning).
However, modern Container technologies are complex in the following manner:
- Container Images alone are stateless. If you do some work with a running image, close (delete) it and re-run it, all your works are gone. This is why Container Images are often configure and run together with Persistent Volumes.
- Networking becomes complex, as the Images are run with dynamically allocated network settings.
The most prominent standard for Container Runtime is called Docker as of today, and the Imaged are called Docker Images. However, some new standards are starting to emerge, which we will discuss later.