Live data from Hacker News

LXC vs. Docker

earthly.dev

21–30 of 147 posts

Re: LXC vs. Docker

#21

Is it accurate to say LXC is to Docker as git is to GitHub, or vim/emacs vs. Visual Studio Code? I haven't seen many examples demonstrating the tooling used to manage LXC containers, but I haven't looked for it either. Docker is everywhere.

lxc launch, lxc list, lxc start, lxc stop, etc....

That's all I've ever needed. Docker is overkill if you just need to run a few containers. There is a point where it makes sense but running a few containers for a small/personal project is not it.

Re: LXC vs. Docker

#22
post #14
post #12

Earlier quoted context omitted.

FWIW I do the same thing but with docker. Exposing the docker daemon on the network and setting DOCKER_HOST I’m able to use the remote machine as if it was local. It’s hugely beneficial, I’ve considered making mini buildfarms that load balance this connection in a deterministic way.

Do you have any more information about how you're doing this? Whenever I've tried to use Docker as a remote development environment the process felt very foreign and convoluted.

I know what you mean, It depends a little bit on your topology.

If you have a secure network then it’s perfectly fine to expose the docker port on the network in plaintext without authentication.

Otherwise you can use Port forwarding over SSH.

To set up networked docker you can follow this: https://docs.docker.com/engine/security/protect-access/

I’m on the phone so can’t give a detailed guide.

Re: LXC vs. Docker

#23

Is it accurate to say LXC is to Docker as git is to GitHub, or vim/emacs vs. Visual Studio Code? I haven't seen many examples demonstrating the tooling used to manage LXC containers, but I haven't looked for it either. Docker is everywhere.

lxc launch, lxc list, lxc start, lxc stop, etc.... That's all I've ever needed. Docker is overkill if you just need to run a few containers. There is a point where it makes sense but running a few containers for a small/personal project is not it.

Funnily enough I view it the other way around. LXC is a bit overkill, I just wanted to run a container, not an entire VM.

In my mind you need to treat LXC containers as VMs, in terms of managements. They need to be patched, monitored and maintained the same ways as a VM. Docker containers still need to patched of cause, many seems to forget that bit, but generally they seem easier to deal with. Of cause that depends on what has been stuffed into the container image.

LXC is underrated though, for small projects and business it can be a great alternative to VM platforms.

Re: LXC vs. Docker

#24
post #12

I use LXC containers as my development environments. When I changed my setup from expensive Mac Books to an expensive work station with a cheap laptop as front end to work remotely this was the best configuration I found. It took me few hours to have everything running but I love it now. New project is creating a new container add a rule to iptables and I have it ready in few seconds.

FWIW I do the same thing but with docker. Exposing the docker daemon on the network and setting DOCKER_HOST I’m able to use the remote machine as if it was local. It’s hugely beneficial, I’ve considered making mini buildfarms that load balance this connection in a deterministic way.

Is there a benefit to this over SSH or VSCode remote?

Re: LXC vs. Docker

#25

LXC via Proxmox is great for stateful deployments on baremetal servers. It's very easy to backup entire containers with the state (SQLite, Postgres dir) to e.g. NAS (and with TrueNAS then to S3/B2). Best used with ZFS raid, with quotas and lazy space allocation backups are small or capped. Nothing stops one from running Docker inside LXC. For development I usually just make a dedicated priviledged LXC container with…

Good comment. It was a revelation to me when I used Proxmox and played with LXCs. Getting an IP per container is really nice.

Re: LXC vs. Docker

#26

I think docker grew out of lxc initially(to make lxc easier to use), for now, lxc is light weight but it is not portable, docker can run on all OSes, I think that's the key difference: cross-platform apps. LXC remains to be a linux-only thing.

Just as long as you ignore the linux VM all those docker containers are running in.

Re: LXC vs. Docker

#28
I’ve been using LXC as a lightweight “virtualization” platform for over 5 years now, with great success. It allows me to take existing installations of entire operating systems and put them in containers. Awesome stuff. On my home server, I have a VNC terminal server LXC container that is separate from the host system.

Combined with ipvlan I can flexibly assign my dedicated server’s IP addresses to containers as required (MAC addresses were locked for a long time). Like, the real IP addresses. No 1:1 NAT. Super useful also for deploying Jitsi and the like.

I still use Docker for things that come packaged as Docker images.

Re: LXC vs. Docker

#29

One major limitation of LXC is that there is no way to easily self host images. Often the the official images for many distributions are buggy. For example, the official Ubuntu images seem to come with a raft of known issues. Based on my limited interactions with it, I'd recommend staying away from LXC unless absolutely neccesary.

If you feel that the existing images (of lxc-download?) have too many bugs for your liking, you could also try the classic templates, which use debootstrap and the like to create the rootfs.

Re: LXC vs. Docker

#30

One major limitation of LXC is that there is no way to easily self host images. Often the the official images for many distributions are buggy. For example, the official Ubuntu images seem to come with a raft of known issues. Based on my limited interactions with it, I'd recommend staying away from LXC unless absolutely neccesary.

I've only played around with LXC/LXD a little bit, what are some of the Ubuntu image issues? I did a quick google, but the first results seemed to be questions about hosting on Ubuntu rather than with the images themselves.

In my experience, most issues are related to kernel interfaces which LXC disables inside unprivileged containers, paired with software that does not check if those interfaces are there/work before attempting to use them.

These issues can be observed in the official Ubuntu image and seem to get worse over time. I would recommend to just use VMs instead.

Post reply on HN