by rtempaccount1 · 7y ago · 0 comments
LXC main dev is on HN. I'm sure he can explain this much better.
The Docker daemon runs as root (which is kind of inevitable, if you don't then you end up needing hacks like slirp4netns to hook up networking)
However, there's nothing innately inside Docker that requires contained processes to run as root.
Indeed it's a standard part of recommended Docker security guidance not to run your contained processes as the root user.
Docker also provide the facility to enable user namespaces at the daemon level, so that root inside the container != root on the host.
Disclaimer: I'm a maintainer of runc, the runtime Docker uses.
It's how Docker doesn't have a good reputation for security.
ofc happy to be corrected, as I'm aware you'd know more about this :)
LXC also supports unprivileged operation (which I named "rootless mode"). Docker gained support for this very recently as an experimental feature in 19.03 (still not released), but LXC has supported it (and defaulted to it whenever possible) for years. Though, the Docker one is arguably better in some respects of lack-of-privilege (thanks to great work from Akihiro Suda and Guissupe Scrvano) but it's still new.
LXC also has put a lot more work into fundamental security work (both in-kernel and within LXC).
Disclaimer: I maintain runc, the runtime Docker uses. There is no question that LXC has better engineering in this department. I collaborate with them quite often, but they have more engineers working on fundamental problems within containers.
For example user mappings were handled very differently in lxc compared to (earlier versions of) docker.
LXC had unprivileged container support since 2013 so that part is fairly mature now. 'Unprivileged' in this case means the container process itself is running as a normal user.
[I maintain runc, and collaborate with the LXC folks.]