News for hackers. Stuff that matters.
Re:Fully Dockerized Linux kernel debugging environment by sneak on Thursday August 11, 2022 @07:42AM (#32424222)
These are privileged containers that can mount things and change kernel settings and do real virtualization.

What is the point, then, of doing all this in docker containers? If you're virtualizing with qemu anyway then why containerize?

I was expecting something like software (non-kvm) emulation in a userspace process in an unprivileged container, or perhaps UML, real brain-in-a-jar stuff.

Re:Fully Dockerized Linux kernel debugging environment by tecleandor on Thursday August 11, 2022 @08:06AM (#32424445)
I haven't read much, but I think the idea is doing all the building process in a container so you don't fill your system with headers, libraries and dependencies.

I don't know how well this deals with caches and so, though.

Re:Fully Dockerized Linux kernel debugging environment by ta988 on Thursday August 11, 2022 @09:56AM (#32425632)
Yes it is just used as an easier to setup manage and dispose of chroot. Which I believe is also a perfect use of docker. It is not all about isolation, sometimes you just want to be able to experiment and go back easily. Sure there are filesystems that allow you to take snapshots but not everybody use these for various reasons.
Re:Fully Dockerized Linux kernel debugging environment by 0xricksanchez on Thursday August 11, 2022 @03:14PM (#32430387)
I wanted containers for the following things:

- Minimal host system requirements as kernel tool chains can be very much a pain to set up correctly. If I want to compile different kernel versions for different architectures this seemed liked a good trade-off. - I wanted to encapsulate every major logic component into a separate instance so working on the individual components does not require building one insanely large image.

Also note this is very much an early prototype and me just experimenting. Nothing is set in stone yet. Things are likely to change along the way.

Re:Fully Dockerized Linux kernel debugging environment by galangalalgol on Thursday August 11, 2022 @10:17AM (#32425978)
If it is using quemu, could you do this to debug an arm image from x86_64
Re:Fully Dockerized Linux kernel debugging environment by 0xricksanchez on Thursday August 11, 2022 @03:15PM (#32430396)
Exactly the use-case I had in mind with this as well :).
Re:Fully Dockerized Linux kernel debugging environment by raverbashing on Thursday August 11, 2022 @08:03AM (#32424402)
> If you're virtualizing with qemu anyway then why containerize?

You're exactly right. Docker does pretty much almost nothing here

For real, dockerizing stuff has become a meme lately

What it (actually) does it simplifying dependencies. But you know, most of the time if you can run docker you can install stuff locally

Docker has a significant performance penalty unless you're running Linux already

Re:Fully Dockerized Linux kernel debugging environment by sph on Thursday August 11, 2022 @08:16AM (#32424555)
A meme? You've said it simplifies dependencies and then go on saying you can install stuff locally, forgetting how much of a nightmare it is to maintain OS-level dependencies, especially when an app depends on a specific version and another app depends on another version.

Containers solve real problems and are here to stay. Feel free not to use them, but saying they're a meme is just trying to be edgy.

Keep on containerising applications.

Sincerely, a sysadmin that has been fighting conflicting dependency requirements, deprecated packages and major distro upgrades for more than a decade.

Re:Fully Dockerized Linux kernel debugging environment by raverbashing on Thursday August 11, 2022 @08:31AM (#32424691)
Containers are not a meme

What's a meme is creating a container for any minor thing like npm + some js project. Or to run one Go binary.

> a sysadmin

Sure, for the deployment of stuff containers are very good. But you know people were using stuff like chroots before that right?

I don't think I'm deploying this debugging system in a webserver.

Re:Fully Dockerized Linux kernel debugging environment by piaste on Thursday August 11, 2022 @09:21AM (#32425189)
> What's a meme is creating a container for any minor thing like npm + some js project. Or to run one Go binary.

You couldn't have picked two more different examples.

Go apps are generally pretty clean statically-linked, native binaries and will be happy to just run from their directory without touching anything else. Containerization is usually unneeded, though if you already have a container ecosystem then they will fit in with no fuss, since the container images are basically glorified tarballs (COPY app/ . RUN foo).

Node.js apps on the other side combine an interpreted language, a messy package management ecosystem, and a fragile and persnickety toolchain that will happily leave dirty stuff in your filesystem and/or your PATH, in order to maximize the risk of dependency-related screwups. Containerization is an absolute godsend for them.

Re:Fully Dockerized Linux kernel debugging environment by raverbashing on Thursday August 11, 2022 @10:01AM (#32425697)
> Go apps are generally pretty clean statically-linked,

I know, that's why I put it as an example (of something that doesn't need docker)

> and a fragile and persnickety toolchain that will happily leave dirty stuff in your filesystem and/or your PATH

Docker existing shouldn't be an excuse for npm behaving like this ;)

But I agree, for deployment it is good. But you can still run npm projects without it

Re:Fully Dockerized Linux kernel debugging environment by yjftsjthsd-h on Thursday August 11, 2022 @12:29PM (#32428154)
> Docker existing shouldn't be an excuse for npm behaving like this ;)

I don't care about the direction of causality, I just want the stupid thing to run on my computer and not pollute my home directory,and docker solves that and solves it well.

Edit: Although actually about the only time I'm touching node is to ship it in a container image for deployment on a cluster somewhere, which is even more compelling.

Re:Fully Dockerized Linux kernel debugging environment by sedachv on Thursday August 11, 2022 @01:42PM (#32429275)
There are much better tools for doing that, such as Guix profiles and nix-shell, which also happen to be better tools for making container images. Linux container images are a distribution mechanism that does not do anything to address package and dependency management other than shifting the problem somewhere else.
Re:Fully Dockerized Linux kernel debugging environment by yjftsjthsd-h on Thursday August 11, 2022 @03:55PM (#32430948)
nix/guix are also good solutions, but they have a much higher learning curve than a Dockerfile; I would even be willing to suggest that docker is not the true best solution to any problem it solves, but in my experience it is the easiest solution to most of them
Re:Fully Dockerized Linux kernel debugging environment by calineczka on Thursday August 11, 2022 @08:48AM (#32424863)
> creating a container for any minor thing like npm + some js project

I am backend engineer with a non-JS background and to me that's a a very useful thing. I really don't want to install specific node version, yarn version, etc to run some node/JS application. If I can just docker-compose up that's much easier to me and I know it does not affect anything globally. So removing it after playing around is easy and non-risky.

Re:Fully Dockerized Linux kernel debugging environment by rixthefox on Thursday August 11, 2022 @09:14AM (#32425107)
I think the point he was making was too many people and projects are turning towards containers as a sort of "end all" where we're abandoning local system dependencies by shipping applications with their own bundled versions of libraries.

My biggest problem with this shift is I'm seeing is people are running their distribution updates and containers are still shipping with vulnerable versions of libraries. So a server admin updates his servers thinking he's all good, No, No he's not because $DEV hasn't updated their container dependencies and now that server gets pwned because here's yet another layer of dependencies I have to deal with on top of the ones I'm maintaining with the OS.

So no, please don't make containers on everything just because you can, because more often than not the container you never intended to be used in production WILL be used in production because someone was lazy and didn't want to deal with the dependencies.

Additionally, to your point, specific node versions? specific yarn versions? Is it really that unreasonable to demand libraries be backwards compatible with warnings on software saying a method is being depreciated? Like I can understand for major revision changes but seriously. I should be able to run the latest version of node and that code still work with warnings telling me that the code I've written will eventually stop working in later versions due to changes in the underlying setup.

My point being, don't weigh on containers as a crutch for badly coded software. Operating systems have moved towards rolling releases, it's about time libraries and programming languages followed suit.

Re:Fully Dockerized Linux kernel debugging environment by raverbashing on Thursday August 11, 2022 @12:36PM (#32428274)
Thanks, you got my point!

And might I add, some people are shipping containers with full unoptimized Ubuntu (or other large distros) for running projects that are kilobytes in size

Re:Fully Dockerized Linux kernel debugging environment by dotancohen on Thursday August 11, 2022 @09:29AM (#32425273)
In what scenario does compromising a container pwn the server?

If the server is running just for that container's application, then the server admin knows it is there and needs updating.

Re:Fully Dockerized Linux kernel debugging environment by rixthefox on Thursday August 11, 2022 @09:51AM (#32425536)
Container escapes are a very real security threat that need to be taken seriously. Just like you wouldn't let all your users have a remote shell on your machines even if they are locked down. Just because they can't get anywhere doesn't mean they can't find ways out of that. If you're on the machine and can run whatever code you want, it's not a matter of if, it's when.

The admin may know what applications they are running in the container but I can bet you they don't know every library that container is shipping and I hold very little faith that these admins are going to pin a laundry list of every single container they run along with all the different versions of libraries each container is bringing and constantly checking that list for CVEs. This problem increases for every single container you bring onto that server.

Edit:

I love containers, don't get me wrong. I've seen first-hand how incredible it is to be able to set up an application inside a container and then remove that application and have no residual packages containing the libraries and dependencies that program needed. I get it. I just don't like how dependent we've become on them.

Now I'm a network engineer first, and server admin second. I don't want to spend a majority of my time pinging container maintainers to update their dependencies when an updated version of a library comes out. I expect to be able to update my local copy of that library and get on with my day and not have to worry about when this library is going to get patched in each of those containers.

Re:Fully Dockerized Linux kernel debugging environment by dotancohen on Thursday August 11, 2022 @11:03AM (#32426840)
I agree with every word, well stated.
Re:Fully Dockerized Linux kernel debugging environment by __MatrixMan__ on Thursday August 11, 2022 @11:53AM (#32427616)
Sure they are. Or rather, their pattern of use is. Wearing your seatbelt is also a meme. Just because something is a meme doesn't mean it's not useful.
Re:Fully Dockerized Linux kernel debugging environment by cmm on Thursday August 11, 2022 @08:19AM (#32424580)
dockerfiles (or even better but less popular, {default,shell,flake}.nix) are code that can be tracked in a repository and reasoned about, "stuff installed locally" isn't.
Re:Fully Dockerized Linux kernel debugging environment by encryptluks2 on Thursday August 11, 2022 @08:32AM (#32424698)
I don't see how Nix is better than Docker as they serve different purposes. While I agree using containers helps aid in automating build environments, you can also checkin shell scripts and Ansible roles into repos as well. I understand the criticism and hopefully people aren't going to be so thin-skinned to take offense, but at the same time if it works then it works.
Re:Fully Dockerized Linux kernel debugging environment by Strum355 on Thursday August 11, 2022 @08:53AM (#32424918)
Nix and Docker share the same purpose in this context: declaring the dependencies needed for this environment. This can include shell scripts, system-level dependencies etc. If anything I would say Nix would be better here (logical middleground in filesystem separation between having access only to whats in the container vs having to juggle system-level dependency versions for the entire system), while also having better version pinning.
Re:Fully Dockerized Linux kernel debugging environment by pxc on Thursday August 11, 2022 @10:27AM (#32426159)
> I don't see how Nix is better than Docker as they serve different purposes

Nix can build many things, among them whole operating systems on the metal, virtual machine images, and container images (including Docker images).

When you use Nix to generate Docker images and deploy them in production using Docker, Nix is not functioning as an alternative to Docker, but your *.nix file is functioning as an alternative to your Dockerfile.

Defining container images in terms of Nixpkgs rather than via a Dockerfile, and assembling it via Nix rathet than `docker build` does have some advantages.

1. It moves you from mere repeatability in the direction of true reproducibility— it makes your outcomes more predictable and reliable

2. Having the benefit of knowledge of the actual dependencies on the system down to the package (or subpackage) level, Nix knows how to generate minimal images when Docker can't.

Plus there's the prospect of reuse, I guess; an environment you've defined in Nix for building Docker containers is easy to install and debug in other environments, without the extra complexity of Docker and filesystems exports/imports, port forwarding, etc. That can be nice, to be able to easily separate out what you're troubleshooting or learning as you're creating or modifying the image's environment.

But yeah that doesn't mean that pairing Dockerfiles with imperative or convergent configutation management or provisioning tools can't also sometimes work well enough in a given situation.

Re:Fully Dockerized Linux kernel debugging environment by BossingAround on Thursday August 11, 2022 @12:55PM (#32428601)
> Docker has a significant performance penalty unless you're running Linux already

Ah yes, the famed Windows/macOS kernel developer... :)

(Not that it's not possible of course, I just found it chuckle-worthy within the context of this article)

Re:Fully Dockerized Linux kernel debugging environment by EddySchauHai on Thursday August 11, 2022 @10:46AM (#32426510)
I like simplicity and for that reason the first thing I do on any project larger than a bash script is setup a container for it. It helps isolate my OS from the project, allows me to easily share it via dockerhub so others can run it, lets me have a sharable dev environment so people can just open it in vscode and edit the project, etc... I've yet to regret using a container and it takes barely any more time than setting it up once for the OS anyway.