Live data from Hacker News

Barco: Linux Containers from Scratch in C

github.com

51–60 of 75 posts

Re: Barco: Linux Containers from Scratch in C

#51
post #27

barco is a project I worked on to learn more about Linux containers and the Linux kernel, based on other guides on the internet.

How did you come up with the name "Barco"?

It's Venetian (my native language) for "hay barrack": http://vec.wikipedia.org/wiki/Barco

Re: Barco: Linux Containers from Scratch in C

#53
post #37

Earlier quoted context omitted.

Looks like a good project to learn container from scratch. Just wondering the main reason you're C since most of the container project now seems to be using Go or Rust?

As the maintainer of a Go container runtime (runc), and having worked with Rust in various other projects, while they can be better languages for building large projects, they make it harder to understand what exactly your program is doing when writing software like this. One example that immediately comes to mind from Rust is a bug with O_PATH file descriptors I found a while ago[1], which would've made certain code…

> One example that immediately comes to mind from Rust is a bug with O_PATH file descriptors I found a while ago[1], which would've made certain code we use in runc not work. [...] Neither of these issues exist in C programs.

This issue doesn't intrinsically affect Rust as a language (when compared to C), because you can just do exactly the same thing as you'd have done in C:

    let fd = libc::open(b"/path\0".as_ptr().cast(), libc::libc::O_CLOEXEC | libc::O_PATH);
Or just make the syscall directly-ish:

    let fd = libc::syscall(libc::SYS_open, b"/path\0".as_ptr(), libc::O_CLOEXEC | libc::O_PATH);
Or use rustix if you want more convenient idiomatic wrappers.

And for setting up containers you'll have to do this anyway because Rust's standard library doesn't expose all of the necessary functionality anyway.

Re: Barco: Linux Containers from Scratch in C

#54
When I did a talk about docker I also wanted to show a bit of what it does under the hood without going through all the layers and without too much details. This ~120 lines of shell script is really good in providing just an intro into what's needed for containers: https://github.com/p8952/bocker/blob/master/bocker (not mine)

Re: Barco: Linux Containers from Scratch in C

#56

Earlier quoted context omitted.

I still think it is tangential. The author stated that they wrote this project to learn. The readme says that it is not intended for production use and that there is no networking set up in the containers. With that context, I doubt that name collisions outside of the containers space are top of mind.

If it was my project, I would want to know about a possible name collision. Saying it once seems fine.

It can be communicated directly to author outside of hn though.

Re: Barco: Linux Containers from Scratch in C

#58
post #25

Question: for sandboxing untrusted code, should I invest time in learning more linux container stuff or switch to learning WASI? I am inclined towards WASI myself.

There's a huge performance hit for many programming languages when you run them inside a WASM runtime. Memory also behaves very different from normal applications. Autovectorizasation also isn't universally supported by WASM compilers yet, which can be costly for performance.

Properly configured WASI runtime are great for security but they're worse than containers on most other fronts. I don't think the downsides make sense unless you're building a business that lets random customers upload WASM files you execute.

Re: Barco: Linux Containers from Scratch in C

#59
post #27

Earlier quoted context omitted.

How did you come up with the name "Barco"?

docker has to do with ships and barco means ship.

It's funny that three people feel the urge to reply for the author and all of them are wrong :-)

Also I find it interesting that in Portuguese as well as in Spanish the word exists in both genders: el barco, la barca, o barco, a barca.

Re: Barco: Linux Containers from Scratch in C

#60
post #59

Earlier quoted context omitted.

docker has to do with ships and barco means ship.

It's funny that three people feel the urge to reply for the author and all of them are wrong :-) Also I find it interesting that in Portuguese as well as in Spanish the word exists in both genders: el barco, la barca, o barco, a barca.

At least in Spanish, my rule of thumb is that "barco" is for bigger boats and "barca" is for smaller ones (and then you have Barça which is the football/soccer team).
Post reply on HN