My first step into the container world in 2021


Hi! I’ve only used containers until recently, but in 2021 I started learning the container world, and I’d like to write about how I started and how it turned out. I’m going to write about how I got started and what I’ve become as a result. Nowadays, there are many different words for container world, such as Kubernetes Docker podman runc. In addition, I often hear the word CloudNative. It would be great if you could refer to how I first tried to challenge the magnificent world of containers 🙏
Here is the result of my introduction in conclusion.

How I got started learning container world

Until about 2020, all I knew about Docker was that it used namespaces(7) and cgroups(7), which are Linux kernel features. I also knew that Kubernetes was sometimes talked about because of its abbreviation and pronunciation, and I had briefly touched it. This was the news that made me want to get into containers. I didn’t understand this news very well, so I felt a bit threatened and decided to get into it.

The first book I came across

This book was talked about in my timeline on Twitter, and I read it as a start. It is the only book I’ve read so far. I’m grateful to @TokunagaKohei, the author of this wonderful book. Sorry, this book is only available in Japanese.
The author, Kohei Tokunaga, has some MEDIUM articles in English. I recommend it because it is very knowledgeable about the container world.

The great thing about this book is that it explains not only how to use Docker but also how containers work. I was waiting for a book like this to come out for a long time.

The book mentioned the Open Container Initiative Runtime Specification, which is one of the container standard specifications. This specification is for the low-level container runtime, that is, the layer that actually creates containers using namespaces(7) and cgroups(7). The low-level container runtime is the software used from Docker and podman and generally, the most famous one is runc implemented in Go.

And after reading the specification, I was like, “Maybe I can make it.” I thought. However, I later realized that I would end up reading the runc code. It would be a lie to say that anyone can build a container runtime, but if you’re an engineer who can read man, you can probably figure it out. There is also a reference implementation called runc, which is a model implementation. I started to implement it because it is the most fun and suitable for me to implement when it is clear what I can build.

BTW, I still recommend the ocean for studying containers :) This is the Japanese sea near my house.

Trying to implement a container runtime

I was familiar with Rust, so I started implementing with Rust. However, later on, this choice of Rust happened to turn out to be a good one. Here is the container runtime I made. It is now part of the containers org repository, but I was the owner of the repository at first. I’ll talk about it later.

The basic policy is to read the specification and make it look like that. The specification says something like “accepts subcommands such as create start delete and do something like this. And if you can make it according to the specification, you can use it.
The community that manages the specification has created runtime-tools as a tool to test if the specification is being followed. I’m very grateful for this. I used this tool to build the container runtime. And it worked!
Actually, you don’t need cgroups(7)to make it work, just make it work with namespaces7and mount around it. It’s a good idea to make it work first, as it will motivate you.

The difficult part of the implementation was that print debugging was difficult due to the handling of tty.

What did I end up learning from implementing a container runtime?

  • What is the reality of containers?
  • How the current container world works
  • Understanding the runc code

And now and in the future

Youki, the container runtime I implemented in Rust, is now in the repository of container org, which implements podman and crun.

In the beginning, it was just for fun, but now I’m trying to figure out how to contribute to the world of container runtimes in a nice, late-breaking way.
I never thought it would come to this, but the people who belong to containers org are container professionals. I’m going to listen to their opinions and try out various things to make it worthwhile.
I’m not going to talk about my motivation for the container runtime and what features I’m going to build because that would be too far off-topic. Please take a look at the issue and README for more information. I’m planning to publish such an article soon. Since this is an OSS, I am always looking for contributors who want to have fun with us. I also prepared the good first issues.

I’m sure you’ll learn more about container runtime and start your journey in this wide world. Try not to drown.
And I still don’t know anything about Kubernetes…

Finally, thank you to all youki’s contributors.

Interested in rust, scala, container, low-level programming, software development.