ComputingHow ToSoftware

How Docker Works In A Local Machine, Namespacing And Cgroups

2 Mins read

Have you ever wondered how docker works in a local machine? What is namespacing and cgroups? In this article, we’re going to walk through how Docker works on a local computer that does not have linux as it’s primary Operating system.

How Docker Works In A Local Machine

There are two primary pieces of technology we need to talk about, first – is the namespacing in Linux kernels and the second is cgroups. Though we will not go into details in this article, it is important to know that these two are key in Docker operations.


Namespacing is a technique (and technology) which containers use to create an abstraction of the underlying host. Namespacing maps a portion of the kernel’s  namespace  to provide isolation between processes running in isolated “containers”. Let’s take a quick look at what namespaces are.  Namespaces are kernel objects which allow the whole of the kernel to be divided into smaller parts.

The namespace specifies an area of the kernel that can be used to restrict access to system resources, such as processes, network connections, inter-process communication (IPC), devices and files.

Namespaces are always stored in files in /proc .  More information on namespaces can be found here.


Once again, it is a technology that provides control over system-level resources by grouping them hierarchically.
The second piece is Linux Control Groups – also  known as LXC containers – which are used with Docker’s cgroups  technology to provide resource allocation to processes that are running within “containers”.
More information on cgroups can be found here.

This shows how docker utilizes namespaces and groups on linux.

If both namespaces and cgroups are linux specific commands, how does docker run on Mac/Windows?

Docker uses another driver by the name of Kernel Streaming (Kernel Streaming is a technology that allows sharing of kernel memory between processes.) This driver is embedded into Docker. As such, it enables containers to run as any other process on that host machine (Linux).

If you want to create a container with cgroup support for Mac and Windows, we need to install Linux Virtual Machine on Mac and Windows, and then the linux kernel will host the different processes for the containers.

How can you check which Linux version is running as a virtual machine to host the Docker on your local machine? – You can simply do the below.

Open up terminal and type.

docker version

The OS shows the virtual machine that Docker containers are running on. As you can see, it shows linux, even if I am currently running this on MacOs.


In a very basic sense, that is how docker runs on your machine, to learn more about basic docker commands, see this article.

Don’t miss amazing tips!

Related posts
How ToProgrammingSoftware

How to link flutter with firebase email password authentication

11 Mins read
Table of contents0.1 firebase email password authentication output flow0.2 Creating our email password authentication on flutter0.3 Step 10.4 Setting up firebase and…
How To

How To Implement Data Tables In Cucumber Using Selenium Ruby

17 Mins read
Table of contents0.1 Advantages of Behavior Driven Development0.2 What is Cucumber?0.3 What are data tables in Cucumber?0.4 How to implement data tables…
How ToProgrammingSoftware

How To Write Clean Code

3 Mins read
Let’s look at tips and tricks on how to write clean code. Everyone wants to be able to write code that is…

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 11 = 20

ComputingHow To

How to install Docker for Windows/Mac