News for hackers. Stuff that matters.
Re:Virtualizing Development Environments in 2023 by foxbyte on Friday August 04, 2023 @03:00PM (#37004316)
Consider exploring LXC for a more mature alternative to Docker. It's not confined to the OCI ecosystem and offers a higher degree of isolation for development environments.
Re:Virtualizing Development Environments in 2023 by seabrookmx on Friday August 04, 2023 @04:24PM (#37005394)
I don't know if I'd use the word "mature" (Docker is quite mature after all), but as a long-time Docker user I did jump into lxc/lxd and can confidently say it's "system container" approach is better for dev environments.

I used to use WSL 2 or a VM, but on a Linux host LXD is a really nice workflow. I can create a fully isolated Linux instance with all my dev tooling on it (optionally script/automate the install of all my tools), and with nested containers enabled I can even run _Docker in that LXD container_ so that when I type `docker ps` on that instance, and `docker ps` on my host, they each have their own set of containers running. For example, I have an ElasticSearch and Redis instance running in the dev box but Syncthing on the host.

Then I can use snapshots to back up the dev environment, or blow it away completely once it gathers too much cruft all without affecting my host. It's really great.

Pair it with VS Code remote SSH and you have a very feature rich setup with little effort.

Re:Virtualizing Development Environments in 2023 by m463 on Friday August 04, 2023 @06:08PM (#37006509)
LXC doesn't have a Dockerfile concept though.

I think a Dockerfile as a recipe for an environment is pretty elegant.

I've used LXC with proxmox and managing what's in a container is kind of like being a sysadmin.

Re:Virtualizing Development Environments in 2023 by stephenr on Friday August 04, 2023 @08:59PM (#37007848)
There is an LXC provider for vagrant, which gets you the one-file concept, with the benefits that not everyone on the project has to use LXC, they just need a provider that works on their host for the specified base box.

This is vagrants' real superpower.

Re:Virtualizing Development Environments in 2023 by tiew9Vii on Friday August 04, 2023 @09:29PM (#37008052)
Docker is cattle, LXC is pets.

Docker packages applications, and should only really have one app inside it. LXC is similar to a vm in it presents itself as a stand-alone machine but uses the host kernel, it’s not like a vm in it’s not as isolated as sharing the host kernel.

So with LXC I agree, managing it is like being a sysadmin as that’s what it’s designed to be.

I use Docker for things that are stateless, maybe throw away, or just test an app quickly. I use LXC for things I want to run multiple services inside, more statefull, typically where people plumb a bunch of Docker images together in I’ll use LXC. The advantage in Proxmox is I tell Proxmos to backup my LXC nightly as it’s treated similar to a VM.

For making LXC feel less like needing to be a sysadmin, you can use Nix to build your LXC images and import in to Proxmox. Your LXC container becomes declarative and not to dissimilar to using a Dockerfile, it’s a far more powerful Dockerfile. What I’ve done is create a bare minimal NixOS LXC with some basic config and use that as a template then edit ‘/etc/nixos/configuration.nix’ inside the LXC on first boot. However as it’s just nixos you can build push the config remotely, use NixOps etc.

It’s a really good workflow using NixOS with LXC however it took me a while to get it as the docs are a bit thin and an old+new version of docs with the new version skipping things mentioned in the old you need to do, I.e change the tty to /dev/console to get a shell inside proxmox console.

Re:Virtualizing Development Environments in 2023 by fbdab103 on Saturday August 05, 2023 @12:46AM (#37009100)
I have never really looked into LXC. How strong are the security guarantees? Presumably less isolated than a real VM, but with significantly better performance?

I have started to run more and more software inside a VM for better security isolation, but the loss of performance is pretty discouraging. For things that are probably fine, I might be willing to trade some theoretical security benefits.