4 ms·
> Each container should have at least the following isolated: network stack, filesystem, processes I'm going to go out on a limb here and say that in 99% of ca
by 0xbadcafebee 6y ago
> Each container should have at least the following isolated: network stack, filesystem, processes
I'm going to go out on a limb here and say that in 99% of cases, there is no benefit to the network isolation. It adds unnecessary overhead and complexity, all so we don't have to configure individual services with a unique listening port. But the host that exposes the virtual networks still has to route something to them, so you still need to assign an arbitrary port and then do some port forwarding.
Going even further in the unnecessary abstractions category is process isolation. In most cases we don't need that either. From a security perspective, I trust the Linux kernel about as far as I can throw it, so I don't care what guarantees there supposedly are, container breakout and local privesc are (in my opinion) a near-certainty. So why are we forcing ourselves to jump through tons of hoops just to heap dump or ptrace() an application? The regular-old security mechanisms in Linux are enough for every other process on the system, why not container processes?
Filesystem abstraction (copy-on-write overlays and chroots) has been the killer feature of containers since day one. That is the one thing about containers that makes them useful: a reproducible application snapshot without dependency management hell. If we strip everything else about containers away, this is the one thing we need to keep the useful purpose of a container.
Docker threw in a lot of extra incredibly extra features, such as the Dockerfile (no more configuration management!) and overlays and build cache and layers, etc. Nobody would be using containers if all these features weren't present in one solution, and we all owe them a big debt and thanks. But if we really strip the container down to its essential useful element, it's basically just a wrapper round chroot().
- JamesSwift 6y agoI don't have a strong enough understanding of either Docker or the specific pieces you mention to form an opinion on your post. I would love if others could chime in to give their perspective on this position though.
- emmelaich 6y agoI mostly agree with peterwwillis, but I regard the security isolation as not prevention against malicious attacks, but a convenience against accidental leakages. Regarding network isolation, it's nice to not have to fiddle with e.g. changing ports in some bit of software to avoid conflicts. Yes there are individual ways to achieve most of what Docker does without wrapping it all up but the wrapping up all the functionality into one is where its value is. Also I love being able to create a container on my mac laptop and then deploying that as a unit to production for repeatability's sake.
- nsajko 6y ago> The regular-old security mechanisms in Linux Do you mean setpriv (separation between users and user groups)? Tangentially related: https://news.ycombinator.com/item?id=23279068 https://news.ycombinator.com/item?id=23279068
- Terretta 6y ago> That is the one thing about containers that makes them useful: a reproducible application snapshot without dependency management hell. Joe Stein, of Kafka renown, calls containers "21st century tarball". // I realize I've mentioned this before, in 2017's "My VM is lighter and safer than your container": https://news.ycombinator.com/item?id=15614777 https://news.ycombinator.com/item?id=15614777
- infogulch 6y agoMy favorite is "static linking for millennials"
- barrkel 6y agoIf you're just using docker and running containers yourself, manually, or via simple daemon scripts, you're not far wrong. If you're deploying to a cloud environment and you just want your stuff to run, have no restrictions around being on the same box or different boxes, and make your stuff find the things it needs to via service names, and have stateless things that auto-scale and load-balance transparently, then you need more isolation because you can't have an environment which delivers that kind of functionality without it.
- jeffbee 6y agoThere are large-scale existence proofs of environments that do all this without any of network or process or filesystem isolation.
- jayd16 6y agoMaybe, but network isolation is an easy way to solve it and the existence of those environments shows its an important thing to solve.
- peterwwillis 6y agoThe thing it's solving is not needing to configure the software to bind on a particular port and IP at runtime. I will agree that this is the easiest possible solution from a usability standpoint. But this functionality adds a unique non-portable requirement to the host, in addition to making routing more difficult. An entrypoint could take care of making the port change at runtime, and then we wouldn't need the extra abstraction. One of the biggest problems of running containers in the cloud is that they're not natively rootless. That largely comes from all the extra layers and abstractions and functionality, which again are super useful, but not necessary. The cloud would be a lot easier to manage if we didn't make it so complex.
- jayd16 6y agoI disagree. You'd still have to manage it, except instead of late binding and managing it in the image routing, you need to manage it in your apps instead. Routing may be complex but IMO the system as a whole is a lot less complex. And philosophically its the same arguments for file system isolation. You could just do the hard work to make sure your software knows not to impact other apps running on the server...but that's the whole thing you want to avoid. We use containers because its hard to guess the environment they'll be run in and we made the decision to jump through some hoops to be able to do this configuration at deploy time not dev time.
- jayd16 6y agoYou're really underestimating the complexity the network isolation is solving for. If you had dynamic port binding, you'd still need to solve for security around open ports, conflict management, and you're adding this complexity into apps of varying quality. I don't know what you're using docker for but in most of my cases, a non-isolated network would require rewrites and a lot of extra management.