What are containers and Docker?

Containers are a popular technology especially Platform as a Service (PaaS) domain. In recent years containers have also spread to developer environments. In this article we will get to know, what containers are and how they differ from virtual machines.

Containers

Container is a feature provided by an operating system that offers isolation for an application, required libraries, mass storage and network connections. The main difference compared to more lightweight isolation solutions, for example Python virtualenv, is that the isolation is so complete that if needed, containers are not aware of each other at all. When compared to virtual machines, contrary to virtual machines, containers do not need to be started like real computers, with full-blown operating system and peripherals. While a virtual machine virtualizes the whole computer starting from the hardware all the way up to the operating system level, a container is simply a virtual run-time environment on top of the operating system.

Fast starting and stopping of environments is just one benefit of containers. Another benefit is compartmentalization. With containers, an application or service can be wrapped to an independent package without worrying about conflicts between different applications. For example, if you want to run a user interface made with Vue.js and Node.js, and you have Java-based business logic running in the background with database written with C++, you can have all three components packaged as separate containers only communicating with each other using virtualized folders and over a virtual network. None of the containers can affect dependencies of the other containers and each container is dedicated to serve only one application. If there is a security update for Node.js, it can be updated without risk to other applications residing in other containers. Also, it is possible to move these containers from one host platform to another or multiply them based on increased demand.

Containers running on software developer workstations ensure that everyone has identical environment for development and debugging.

Because of light weight and relatively simple structure, it is easy to create templates with containers. These templates can then be duplicated and “inherited” when creating new containers. This allows focusing on creating actual application environments based on standard templates that others have created instead of spending time repeatedly configuring the base systems.

Docker

The name Docker is mostly heard when we talk about containers. This is simply because Docker provides user-friendly experience for using containers. Even though containers is a relatively old technology originating from 1990’s, was Docker Inc. the company that managed to productize the concept of containers about ten years ago. Since then, “Docker container” has been more or less a synonym for containers.

The company Docker Inc. offers a centralized service called Docker Hub where users can freely distribute and load ready-made container templates. These templates usually contain environments based on different Linux distributions. Usually, when you create a new Docker container, you will build one by defining an existing base container that is automatically loaded from Docker Hub.

This blog post starts a series of articles that will, with examples, introduce to you the container technology and their benefits. In the next part, we will create our first Docker container by using Docker Hub and the command-line tools offered by Docker.

Writer is Matti Kärki, a senior developer from Ouro

Edellinen artikkeli
Ouron tarina
Seuraava artikkeli
Kullanhuuhdonta