# How Docker Works? Under the Hood Look at How Containers Work on Linux

DevFeed: [How Docker Works? Under the Hood Look at How Containers Work on Linux](<https://devfeed.tech/articles/how-docker-works-under-the-hood-look-at-how-containers-work-on-linux-24983.md>)

Original publisher: [Read original article](<https://codeahoy.com/2019/04/12/what-are-containers-a-simple-guide-to-containerization-and-how-docker-works/>)

Author: umer

Published: 2019-04-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Code Ahoy - Articles](<https://devfeed.tech/sources/code-ahoy-articles.md>)

Topics: [Docker](<https://devfeed.tech/topics/docker.md>), [Containers](<https://devfeed.tech/topics/containers.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Node.js](<https://devfeed.tech/topics/node-js.md>), [Processes](<https://devfeed.tech/topics/processes.md>), [virtual machines](<https://devfeed.tech/topics/virtual-machines.md>)

Tags: [containers](<https://devfeed.tech/tags/containers.md>), [docker](<https://devfeed.tech/tags/docker.md>), [linux](<https://devfeed.tech/tags/linux.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [processes](<https://devfeed.tech/tags/processes.md>), [virtual-machines](<https://devfeed.tech/tags/virtual-machines.md>)

## AI overview

This tutorial explains how Docker uses containerization on Linux to isolate processes and provide applications with customized views of operating-system resources. It contrasts containers with virtual machines, which require separate guest operating systems, and uses applications with different Node.js version requirements as an example.

## Source excerpt

Docker is awesome. It enables software developers to package, ship and run their applications anywhere without having to worry about setup or dependencies. Combined with Kubernetes, it becomes even more powerful for streamlining cluster deployments and management. I digress. Back to Docker. Docker is loved by software developers and its adoption rate has been remarkable. In this post, we'll look at how Docker works under the hood. Docker uses a technology called "Containerization" to do its magic and that's what we are going to explore next. Why Do We Need Containers? Let's say you want to run a software Foo on your computer. Foo requires Node.js version 10 (assume Foo is incompatible with newer Node.js versions), so you install Node 10 on your machine. Later, you want to run another software, Bar, which requires Node.js version 15. This has created a problem. (Assume we can't use nvm to switch between Node versions easily.) One way we could solve this problem is by using Virtual Machines or VMs to create isolated environments for running Foo and Bar. You can create one VM with Foo and Node 10 and another with Bar and Node 15. Voila, we are back in business. However, there's an issue with this approach: it's very inefficient. Each VM requires its own operating system. We are now running two separate guest operating systems on our computer just to run two different processes. What if there was a way to run Foo and Bar and your machine without running two extra operating systems? Let's review the interaction between processes and operating system. Whenever a process wants to do anything, it asks the operating system. Processes like Foo and Bar would ask the OS questions like, "which Node version do you have installed?" or "how much memory is available to me?" or "what other processes are running?" What if we could intercept and control the communication between processes and operating systems and send customized responses to processes to control their behavior? For ex