3 ms·
Ask HN: Why Docker in Addition to Ansible onto VMs?
(In this discussion, I'm going to say "Ansible" a lot, but what I really mean by that is "your favourite deployment and configuration tool". I just use Ansible as an example of the broader category.)
To begin with, I'll clarify what I think is the sort of scenario where this question becomes relevant. If I have to run a bunch of services, some continuously, and others as cron jobs, I imagine my options are to either
a) Deploy them onto separate virtual machines using Ansible, or
b) Create Docker images of them, which I then deploy onto a machine, again using Ansible.
I can't imagine a scenario where it would not be useful to know Ansible. This is where I feel the primary cost of Docker is incurred: it is an additional layer of abstraction that has to be learned, taught to new admins, troubleshot, and kept in sync. Troubleshooting any Unix system including a VM is the same, but a Docker container has to be troubleshot differently.
----
Due to the submission character count limit, I have submitted the most common arguments I have heard in a comment. Please read that first.
-----
In summary, this is my picture of the situation:
- Docker cannot replace regular configuration management tools like Ansible. Docker, being an additional layer of abstraction, comes at a maintenance cost.
- Performance is not enough of a reason to offset the maintenance cost.
- File system management is not enough of a reason to offset the maintenance cost.
- Upgrade handling is not enough of a reason to offset the maintenance cost.
I get the sense that it's a wash, and the deciding factor is whether you are more experienced with Docker administration or Unix administration.
But there are very experienced Unix sysadmins who have switched to Docker and never looked back. I just haven't heard a satisfying explanation as to why.
It'd make my day if any of you guys could do that. Thanks!
- kqr 8y agoSo some reasons people bring up for using Docker: "A full virtualized system gets its own set of resources allocated to it, and does minimal sharing. You get more isolation, but it is much heavier (requires more resources)." Is that really true? The few recent-ish comparisons I find between Docker and VMs indicate that services running under both perform comparably, thanks to modern advances in hardware-assisted virtualisation. (I also get the sense that people frequently use Docker on top of virtual machines.) But if VMs do not use resources efficiently for your purposes, you can use the exact same Ansible scripts you installed the VM with to install your services onto a dedicated physical machine instead. No need to change anything. "AuFS is a layered file system, so you can have a read only part and a write part which are merged together. One could have the common parts of the operating system as read only (and shared amongst all of your containers) and then give each container its own mount for writing." Am I misunderstanding something if I think this is exactly how regular mount works? It's literally a layering of disks (or disk images.) If you mount / as read-only (which is not a bad idea in general either) then you can have multiple virtual machines sharing the same base disk image. "Regarding consistency, Docker images are immutable. It should be self-evident that it is easier to maintain something that does not change. Your config won't suddenly break because the OS updated itself." Sure, freezing software in points of time is very easy to deal with. But what about security updates? If you are going to do updates anyway, you still have to have workflows in place to deal with changing images. I'd also argue that if your config breaks all the time for OS update reasons, you should probably consider running a different OS in your production environment. "the following is a speed comparison of start and stop times for the two different technologies:" Yes, I recognise that Virtual Machines can take up to several minutes to provision, while Docker containers can be spun up in seconds. I do see how Docker is a huge deal if, at the core of your problem domain, you find "needing to spin up new instances of services in seconds but no ability to run hot spares". That sounds like a very limited domain, though.