• 8 hours
  • Medium

Free online content available in this course.

course.header.alt.is_certifying

Got it!

Last updated on 8/28/24

Discover Containers

Part One will be your introduction to containers and Docker. But before all that, we need to go back over some important concepts:

  • What is a virtual machine?

  • What is a container?

  • Why use containers?

In the past, when we needed servers, we had to buy physical ones with a set quantity of CPU, RAM, or disk storage space.

However, we would regularly need additional power for periods of high load (e.g., popular holidays), so you’d have to buy additional servers to handle peak usage. A solution was created to respond to this problem: the virtual machine.

Understand What a Virtual Machine is

Virtual Machine Components
Virtual Machine Components

When you use a virtual machine (VM), you’re doing what is known as heavy virtualization. You’re actually recreating a complete system in the host system so that it has its own resources.

This gives you complete isolation from the host system, but it does have a few drawbacks:

  • ❌ A virtual machine takes time to start up.

  • ❌ A virtual machine reserves resources (CPU/RAM) on the host system.

However, there are also various advantages to this solution:

  • ✅ A virtual machine is completely isolated from the host system.

  • ✅ The resources allocated to a virtual machine are completely reserved for this VM.

  • ✅ You can install different operating systems (Linux, Windows, etc.).

Often, though, the application the VM is running doesn’t use up all of the available resources, which gave rise to a new, more lightweight virtualization system: containers.

Understand What a Container is

A Linux container is a lightweight process or set of processes that are isolated from the rest of the system.

A container allows for lightweight virtualization, which means that it doesn’t virtualize the resources, it just isolates the processes. Containers therefore share resources with the host system.

Containers vs. Virtual Machines
Containers vs. Virtual Machines

Containers like OpenVZ and LXC provide good isolation of system processes; however, the CPU, RAM, and disk resources are fully shared with the whole system. Containers share the Linux kernel, so it isn’t possible to run a Windows or BSD system.

Let’s take a look at a few advantages of containers.

Only Reserve Necessary Resources

Another considerable way in which containers are different to virtual machines is that they don’t reserve the entirety of CPU, RAM, and disk resources attributed to the host system. This means that we can allocate 16 GB of RAM to our container, but if it only uses 2 GB, the rest will not be locked.

A Speedy Start

As containers only need isolation and not virtualization of resources, they can be started much more quickly and frequently than a virtual machine on our host servers, allowing for a slight reduction in infrastructure costs.

Increased Developer Autonomy

Beyond financial concerns, containers can also be run on developer workstations, thereby reducing the differences between the production environment and the local environment on developer workstations.

Understand Why We Use Containers

With containers, we can reduce costs and increase infrastructure density while improving the deployment cycle.

As containers can be started very quickly, they are often used in production to add available resources, helping to meet sizing or scalability requirements. However, they also respond to pre-production requirements. As they are lightweight and quick to start, they allow for the creation of dynamic environments, thereby responding to business needs.

Let’s Recap!

  • You now know how a container differs from a virtual machine. You’ve also seen the differences between heavy virtualization and lightweight virtualization.

  • Containers should always be lightweight. They should be free of unnecessary content so that they can be started quickly, however they do provide less isolation. Virtual machines, on the other hand, provide very good isolation but are generally slower and much heavier.

In the next chapter, we’ll discover a container solution that has established itself as a leader in containerization technology, and which you’ll be learning to use in this course: Docker!

Example of certificate of achievement
Example of certificate of achievement