Member-only story

How to create network namespaces like docker or any container runtime ?

Xavier Pestel (Xavki)
3 min readSep 12, 2024

Docker or container runtimes implement multiple namespaces. For example, docker uses user, ipc, mount namespaces… and network namespaces.

Bridge & network namespace

Namespaces are one of fundamentals about containerization on linux based. Second important tools are cgroups of course.

But namespaces provide you the capacity to isolate process. Without isolation, no containerization. And the network namespace allow you to create a dedicated network for your process. By this way, the process see only its own localhost (127.0.0.1) and its interface connected o the bridge.

So, to begin, I think it’s a good idea to discover how to install some network namespaces and a bridge like docker does for you so easily.

Go go go !!

Let’s define some variables

You’ll see it below, we’ll need to us and re-use many command line.

To avoid to edit again and again same values or if you want to change its, start by defining variables.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Xavier Pestel (Xavki)
Xavier Pestel (Xavki)

Written by Xavier Pestel (Xavki)

Microservices architecture and opensource. I’m maintainer of xavki https://youtube.com/c/xavki-linux about opensource. My blog : https://xavki.blog/

No responses yet

Write a response