The main difference between LXC and Docker

What is the main difference between LXC and Docker?


I am a beginner and learning but one thing I have noticed is that LXC containers boot with systemd (or openrc depending on the distribution). Wheras Docker containers give a weird error message about any service initiated with systemd.

Also, with a bridge, LXC containers can have their own IP address visible on the entire network just like a virtual machine, whereas Docker Containers are assigned an IP address by the NAT from Docker. So these docker containers cannot be accessed from outside. Hence the need for port forwarding.

Also, with Docker If you have 5 containers from the same image then you save a lot of disk space as each container is just a list of changes made to the original image. Consequently you cannot delete this original image if any container is based on it. Whereas with LXC each of those five containers will take up an entire image for itself. So you can delete the original image once you have created a container from it.

I am sure others will list many more differences. I am keen to know as well :thinking:

Docker is App container but LXC not?

While Docker is intended for App-containers (basically only one program) and LXC/LXD is intended for system-containers (whole systems with multiple programs), you can still use both for both cases (though this is not so convenient).

But like Wolfgang pointed out, there are other specific differences as well.

Docker: application container

LXD: operating system container

So then, what is the difference between ‘application’ and ‘operating system’ containers? :thinking:

I know other examples of application containers - podman, rocket. But are there other examples of operating system containers?