Introduction to containers: Difference between revisions

From Stat DS Computing Wiki
Created page with " == What are Containers? == Containers are packages of software that contain all of the necessary elements to run in any environment. In this way, containers virtualize the o..."
 
No edit summary
 
Line 1: Line 1:
[[Category:Containers and Virtual Environments]]


== What are Containers? ==
== What are Containers? ==

Latest revision as of 03:17, 29 June 2026


What are Containers?

Containers are packages of software that contain all of the necessary elements to run in any environment. In this way, containers virtualize the operating system and run anywhere, from a private data center to the public cloud or even on a developer’s personal laptop. In other words, Containers are lightweight packages of your application code together with dependencies such as specific versions of programming language runtimes and libraries required to run your software services. They make it easy to share CPU, memory, storage, and network resources at the operating systems level and offer a logical packaging mechanism in which applications can be abstracted from the environment in which they actually run. 

N.B. Containers are different from virtual machines. The key differentiator between containers and virtual machines is that virtual machines virtualize an entire machine down to the hardware layers and containers only virtualize software layers above the operating system level. 

N.B Containers are different from virtual environments. Virtual environments are not a real isolation, they are a “poor man's isolation” using path hacks and symlinks - you're still within your own operating system. A Python virtual environment, for instance, only encapsulates Python dependencies. A Docker container encapsulates an entire OS. With a Python virtual environment, you can easily switch between Python versions and dependencies, but you're stuck with your host OS.

N.B. Virtual Machines vs. Containers vs. Virtual Environments. These constitute three levels of diminishing isolation, going left to right. You could think of a container as a middle-ground between a virtual machine (heavy, expensive) and a virtualenv (light, cheap).

What are the benefits of containers?

From a general (i.e., non-research) perspective, we can say the following (see the next article about Docker for research-related benefits):

Separation of responsibility

Containerization provides a clear separation of responsibility, as developers focus on application logic and dependencies, while IT operations teams can focus on deployment and management instead of application details such as specific software versions and configurations.

Workload portability

Containers can run virtually anywhere, greatly easing development and deployment: on Linux, Windows, and Mac operating systems; on virtual machines or on physical servers; on a developer’s machine or in data centers on-premises; and of course, in the public cloud. 

Application isolation

Containers virtualize CPU, memory, storage, and network resources at the operating system level, providing developers with a view of the OS logically isolated from other applications.

Benefits with respect to Virtual Machines

  • Containers are much more lightweight than VMs
  • Containers virtualize at the OS level while VMs virtualize at the hardware level
  • Containers share the OS kernel and use a fraction of the memory VMs require

What are containers used for?

Agile development

Containers allow your developers to move much more quickly by avoiding concerns about dependencies and environments.

Efficient operations

Containers are lightweight and allow you to use just the computing resources you need. This lets you run your applications efficiently.

Run anywhere

Containers are able to run virtually anywhere. Wherever you want to run your software, you can use containers.

Useful additional resources

  • Containerization explained: [1]
  • Containers vs. VM: [2]