14 ms·
Ignorance admission time: I still have no idea what problem containers are supposed to solve. I understand VMs. I understand chroot. I understand SELinux. Hell,
by dreamcompiler 10y ago
Ignorance admission time: I still have no idea what problem containers are supposed to solve. I understand VMs. I understand chroot. I understand SELinux. Hell, I even understand monads a little bit. But I have no idea what containers do or why I should care. And I've tried.
- betaby 10y agoIncrease server utilization by packing multiple non-hostile tenants on it, quickly create test environments, have a volatile env. You can have all of those with VMs although at much higher CPU, RAM usage cost.
- boris 10y agoWith one big limitation: they must all run the same os kernel (so you cannot run say a Windows or FreeBSD container on a Linux host). In fact, nobody guarantees that say Fedora will run on an Ubuntu-built kernel. Or even on a kernel from a different version of Fedora. So, IMO, anything other than running the exact same OS on host and in container is a hack.
- the8472 10y ago> In fact, nobody guarantees that say Fedora will run on an Ubuntu-built kernel. "nobody guarantees" just means that you can't externalize the work of trying it and seeing if it works. I don't think that's a huge loss, considering the space of all possible kernels, configuration switches, patches and distro packages is huge. It's like refusing to use a hammer because nobody can assure you that hammer A was thoroughly tested with nail type B.
- boris 10y agoNo, its like using a nailgun A with nails Y when it's only guaranteed to work with nails X. Or like using a chainsaw A with chain Y when it says you should use X. But hey, at least you are not trying to use nails on a chainsaw... ;-)
- vor1968 10y agoNo. It's like shooting yourself in the face because your friend survived it.
- lloeki 10y ago> nobody guarantees As long as the ABI is stable and you don't reach out to something that would have moved within /{proc,sys,whatevs}, you're good. [0] [0]: https://en.wikipedia.org/wiki/Linux_kernel_interfaces https://en.wikipedia.org/wiki/Linux_kernel_interfaces
- AstralStorm 10y agoMeasure the "much higher" before deciding. Especially after you apply solutions to reduce the memory and disk cost. I'd say the "much higher" is nowadays a relic of the past.
- colordrops 10y agoIn my experience it does two things that VMs don't do as well: 1. More efficient use of hardware (including spin up time) 2. Better mechanisms for tying together and sharing resources across boundaries. But in the end they don't really do anything you couldn't do with a VM. It's just that people realized that VMs are overkill for many use cases.
- deckiedan 10y agoThey make shared folders and individual files a lot easier than VMs, also process monitoring from the "host".
- AstralStorm 10y agoVery much not worth the cost of reduced security and reliability. You also have vastly more complicated failover due to no easy migration.
- dreamcompiler 10y agoThese comments are helpful. Thanks. Sounds like for a given piece of hardware you might be able to fit 2 or 3 VMs on it, or a lot more containers. But without the security barriers of VMs. That being the case, why not just use the OS? And processes and shared libraries?
- ianburrell 10y agoThe isolation means that don't have to worry about containers interfering with each other. It is more about separating and hiding processes rather than protecting from hostile attacks. The other big advantage is containers provide a way to distribute and run applications with all their dependencies except for the kernel. This means not having to worry about incompatible libraries or installing the right software on each machine.
- mwpmaybe 10y ago> That being the case, why not just use the OS? And processes and shared libraries? That's essentially what a Linux container is: a process (that can fork) with its own shlib. If you have lots of processes that don't need to be isolated from each other and can share the same shlib, then no, you don't need this mechanism.
- dreamcompiler 10y agoOkay, so it's a nice self-contained packaging mechanism that obviates dependency hell. Sounds a bit like a giant lexical closure that wraps a whole process. And from which escape is somewhat difficult. Makes sense.
- candiodari 10y ago> the same shlib, then no, you don't need this mechanism And if you want to use a modern development tool chain you don't really have this choice. They produce statically linked binaries that need, at minimum, their own process and TCP port (if you run a proxy which when you think about it is pretty wasteful). There is no good reason (other than ease of tool chain development) for that, and it's probably cost hundreds of millions or even billions of dollars in servers and power, but there you go. PHP and Java are essentially the only languages with good support for running without containers, and Java isn't even used that way usually.
- meddlepal 10y agoEveryone says containers help resource utilization but I think there killer raison d'etre is that they are a common static binary packaging mechanism. I can ship Java, Go, Python, or whatever and the download and run mechanism is all abstracted away.
- dreamcompiler 10y agoDoes this mean we're admitting defeat with shared libraries and we're going back to static libraries again?
- mook 10y agoMostly, yes. Notice that Go and Rust (two of the newer languages popular at least on HN) also feature static compilation by default. Turns out that shared libraries are awesome, until the libraries can't provide a consistently backwards compatible ABI.
- zuzun 10y agoGo has no versioning, in Rust everything is version 0.1... then one day you update that serialization library from 0.1.4 to 0.1.5 and all hell breaks loose because you didn't notice they changed their data format internally and now your new process can't communicate with the old ones and your integration test missed that because it was running all tests with the new version on your machine. This makes you implement the policy "Only rebuild and ship the full stack" and there you are, scp'ing 1GB of binaries to your server because libleftpad just got updated.
- michaelmrose 10y agoExcept outside of Javascript nobody on earth makes libleftpad
- michaelmrose 10y agoExcept outside of Javascript nobody on earth makes libleftpad and whose binaries are 1gb?
- sarnowski 10y agoContainers are just advanced chroots. They do the same with the network interface, process list and your local user list as chroot is doing with your filesystem. In addition, containers often throttle resource consumption of CPU, memory, block I/O and network I/O of the running application to have some QoS for other colocated applications in the same machine. It is the spot between chroot and VM. Looks like a VM from the inside, provides some degree of resource usage QoS and does not require you to run a full operating system like a VM. Another concept that is now also often automatically connected to containers is the distribution mechanism that Docker brought. While provisioning is an orthogonal topic to runtime, it is nice that these two operational topics are solved at the same time in a convinient way. rkt did some nice work to allow you to choose the runtime isolation level while sticking to the same provisioning mechanism: https://coreos.com/rkt/docs/latest/devel/architecture.html#stage-1 https://coreos.com/rkt/docs/latest/devel/architecture.html#s...
- dreamcompiler 10y agoVery helpful. Thanks.
- AstralStorm 10y agoUnfortunately containers provide about the same security as chroots too. Nothing even close to a true virtual machine with not much lower cost.
- maccam94 10y agoSeccomp, apparmor, and namespacing (especially user!) do add a lot more security than plain old chroots, but still not at the level of a VM.
- cm2187 10y agoBut couldn't containers have been designed that way? One thing I have in mind is one of windows 10 recent features, which consist in running certain applications using the same hardware level memory protection mechanism than VMs, so that the application is safe from the OS/Kernel, and the OS/Kernel is safe from the application (can't find the exact name for this new feature unfortunately).
- elvinyung 10y agoAm also a huge newcomer to this. Yeah, I think a lot of it is better resource utilization compared to VMs. At the same time, though, I don't think containers are the thing, but just a thing that paves the way for something very powerful: datacenter-level operating systems. In 2010, Zaharia et al. presented [1], which basically made the argument that increasing scale of deployments and variety of distributed applications means that we need better deployment primitives than just at the machine level. On the topic of virtualization, it observed: > The largest datacenter operators, including Google, Microsoft, and Yahoo!, do not appear to use virtualization due to concerns about overhead. However, as virtualization overhead goes down, it is natural to ask whether virtualization could simplify scheduling. But what they didn't know was that Google has been using containers for a long time. [2] They're deployed with Borg, an internal cluster scheduler (probably better known as the predecessor to the open-source Kubernetes), which essentially serves exactly as an operating system for datacenters that Zaharia et al. described. When you think about it that way, a container is better thought of not as a thinner VM, but as a thicker process. > Because well-designed containers and container images are scoped to a single application, managing containers means managing applications rather than machines. In the open-source world, we now have projects like Kubernetes and Mesos. They're not mature enough yet, but they're on the way. [1] https://cs.stanford.edu/~matei/papers/2011/hotcloud_datacenter_os.pdf https://cs.stanford.edu/~matei/papers/2011/hotcloud_datacent... [2] http://queue.acm.org/detail.cfm?id=2898444 http://queue.acm.org/detail.cfm?id=2898444
- candiodari 10y agoThe big missing "virtualization" technology is the Apache/CGI model. You essentially upload individual script-language (or compiled on the spot) functions that are then executed on the server in the context of the host process directly. This exploits the fact that one webserver only differs from another by the contents of it's response method, and other differences are actually unwanted. You can make this a lot more efficient by simply having everything except the contents of the response method be shared between different customers. This meant that all the Apache mod_x (famously mod_php and mod_perl) can manage websites on behalf of large amounts of customers on extremely limited hardware. It does provide for a challenging security environment. That can be improved when starting from scratch though.
- mbesto 10y agoEliminates the redundancy of maintaining an OS across more than 1 service.
- _pmf_ 10y agoSame with me. This plays right into the complexity issue. Even if you understand them, you have to understand the specific configuration (unlike VMs, where you have a very limited set of configurable options, and the isolation guarantees are pretty much clear).
- RantyDave 10y agoThey're VM's but much more efficient and start faster. There's a clever but shockingly naive build system involved. That's pretty much it. Going beyond this you get orchestration - which you can certainly do with VM's but it's slow; and various hangovers from SOA rebadged and called microservices. But they're really, really efficient compared to VM's.
- kerny 10y ago> The're VM's They are definitely not VMs. > But they're really, really efficient compared to VM's. I think that the virtualisation CPU overhead is below 1%. Layered file systems are possible with virtual machines as well so disk space usage could be comparable. What do you mean that they are "really, really efficient" ?
- RantyDave 10y ago5-10%, realistically, with some very informal testing. Not really a particularly big deal. Really really efficient relates to how many containers can be run on a given system vs VM's. About 10x as many.
- mping 10y agoI will show you some use cases: - have different versions of libs/apps on the same OS (or run different OS's) - tinker with linux kernel, etc without breaking your box (remember the 90's?) - building immutable images packed with dependencies, ready for deploy - testing distributed software without VMs (because containers are faster to run) - if you have a big box (say 64gb, eight core or whateva) or multiple big boxes, you can manage the box resources through containerization, which can be useful if you need to run different software. Say every team builds a container image, then you can deploy any image, do HA, Load balancing, etc. Ofc this use case is highly debatable
- unixhero 10y agoI don't understand Docker to be honest. It was a big pain to have unexplainable race conditions when I tried to use it for production apps. Ended with a spectacular data loss, of my own company's financial data. Luckily I had 7-day old SQL exports.
- eddieroger 10y agoI'm with you, but I've found a single use case that I'm running with, and potentially a second that I'm becoming sold on. So far, the most useful thing for me is being able to take a small application I've written, package it as a container, and package it in a manner when I know it will run identically on multiple remote machines that I will not have proximity to manage should something go wrong. I can also make a Big Red Button to blow the whole thing away and redownload the container if need be, since I was (correctly) forced to externalize storage and database. I can also push application updates just by having a second Big Red Button marked "update" which performs a docker pull and redeploy. So now, what was a small, single-purpose Rails app can be pushed to a dozen or so remote Mac minis with a very simple GUI to orchestrate docker commands, and less-than-tech-savvy field workers can manage this app pretty simply. I'm also becoming more sold on the Kubernetes model, which relies on containers. Build your small service, let the system scale it for you. I don't have as much hands-on here yet, but so far it seems pretty great. Neither of those are the same problems that VMs or chroot are solving, as I see it, but a completely different problem that gets much less press.
- vosper 10y agoI'm very new to containers, but I think I'm starting to get the hype a bit. Recently I was working on a couple of personal projects, and for one I wanted a Postgres server, and for the other PhantomJS so that I could do some webscraping. Since I try to keep my projects self-contained I try to avoid installing software onto my Mac. So my usual workflow would be to use Vagrant (sometimes with Ansible) to configure a VM. I do this infrequently enough that I can never remember the syntax, and there's a relatively long feedback loop when trying to debug install commands, permissions etc. I gave Docker a try out of frustration, but was simply delighted when I discovered that I could just download and start Postgres in a self-contained way. And reset it or remove it trivially. I know there's a lot more to containers than this, but it was an eye-opener for me.
- jbattle 10y agoYeah this fits my experience exactly. I suppose I use docker a lot like a package manager (easy to install software and when I remove something I know it will be cleaned up). Nearly every time I install actual software on my mac (beyond editors & a few other things) I feel like I end up tripping over it later when I find half my work wants version N and the other wants version M
- cookiecaper 10y agoYou can do this with Vagrant already. Before Vagrant, people distributed slimmed-down VM images for import and execution. Why is this ascribed as a unique benefit of containers?