News for hackers. Stuff that matters.
Re:My VM is lighter and safer than your container by frou_dh on Thursday November 02, 2017 @11:41AM (#15611387)
My personal long bet has been to completely ignore Docker etc. Seems that has bounced between plain ugly apathy and foresight.
Re:My VM is lighter and safer than your container by koolba on Thursday November 02, 2017 @12:59PM (#15612140)
Putting aside deployment, Docker has been a sheer joy for local development. It provides a complete wrapper for the voodoo and tribal knowledge required to run packaged apps.

Gone are the days of building a VM from scratch, following instructions for a previous version of the OS, installing 10 dependencies, installing the app, cursing when it fails half way through, installing another missing dependency, installing the app again, bouncing the server, and then having it all fall apart again because the app isn't registered to run as a service at startup (because you missed that step).

All of this was possible before Docker through Vagrantfiles and the like but Docker made it much cleaner and significantly less resource intensive (i.e. no longer need a VM per item).

Re:My VM is lighter and safer than your container by apple4ever on Thursday November 02, 2017 @01:26PM (#15612361)
This is why you do config management. Here, our Vagrant builds are exactly like our development and production servers. Its literally the same config to run them both, with just variables to differentiate as needed.
Re:My VM is lighter and safer than your container by derefr on Thursday November 02, 2017 @03:40PM (#15613556)
Your argument falls down when it's not your development-time build, but some third-party's. Docker allows you to basically treat "other people's daemons" the way most programming runtimes treat "other people's libraries": as something you can just toss into a dependency spec file and have "pulled in" to your program during build.

With Vagrant, I still need to figure out how to install e.g. Postgres, or Redis, or whatever, into the Vagrant VM (usually using salt/chef/ansible/etc.), or—much more rarely, because this isn't "idiomatic"—I'll find a Vagrantfile for someone else's virtual Postgres appliance VM. Which I then need to integrate into my virtual-network architecture as its own separate VM with its own lifecycle management et al.

With Docker, my app's image just depends on the postgres:9.6 Docker image, and so when I start my app, a copy of Postgres is downloaded and started as well. My app "owns" this container: the config management for what version of Postgres is running is done by my app (just like a library dependency), rather than the resulting container being thought of as a separate "piece" of my system to be managed by the ops team. The ops team manages my service, which contains Postgres as a component. Same as if I had built a VM that contained both my app and Postgres.

In short, containers (and especially the higher-level abstraction of container "services" or "pods") allow you to build and plan your service as a set of separate black-boxes, rather than owning their build processes; but then allow you to run your service as a unit and upgrade it as a unit, rather than each build-time component resulting in a separate runtime consideration.

---

And yes, all this could be accomplished just as well with VMs. There's nothing specifically about containers that makes them able to do things that VMs cannot. It's just how the two ecosystems have evolved.

If you:

• built an equivalent of Docker's "public registry" and "private URL-accessible registries" for VMs—maybe by generalizing AWS's AMI registry

• ensured that all common VM software could start VMs using a spec that pointed at an AMI URN/URL, downloading and caching AMIs from wherever in the process

• encouraged a public stance toward having a Vagrantfile in your project root that will—with no configuration—build a public-usable virtual appliance out of your project

• added automatic-build-from-Vagrantfile support to your public AMI registry

• encouraged an 'immutable infrastructure' approach to the resulting Vagrant VMs, such that they'd put all their state into hypervisor-provided stateful mounts (of SAN disks or NFS or what-have-you)

• enforced a common semantics for services/pods of VMs in hypervisors

...then you could treat VMs the way you treat containers, using the VM-management client tooling to push out a version-upgrade of your service, that would replace various VMs with VMs based on a newer AMI—without losing any state.

It's all a matter of changing the culture and idioms. That doesn't mean it's easy.

Re:My VM is lighter and safer than your container by djb_hackernews on Thursday November 02, 2017 @02:38PM (#15613054)
Docker doesn't imply not having config management. In fact for our infrastructure that was using puppet to build vms, we just run puppet as part of `docker build` instead. Still using config management and our prod, staging and dev environments run the same exact blobs.
Re:My VM is lighter and safer than your container by geerlingguy on Thursday November 02, 2017 @09:11PM (#15615955)
Sometimes; and tools like Ansible Container can help have the best of both worlds.

But for every time I see someone using actual configuration management and best practices for reproducible Docker architecture, I see a hundred times when there are brittle and convoluted shell scripts or worse, entire application definitions in a 500+ line Dockerfile (which is neither configuration management nor scripts. At least the scripts are somewhat more portable and maintainable!)

Re:My VM is lighter and safer than your container by jjawssd on Thursday November 02, 2017 @01:05PM (#15612190)
Instead of writing a build script to put everything together from a solid foundation, Docker implicitly encourages you to perform a succession of random undocumented changes on the original foundation endlessly. Also known as "tribal knowledge." And this is all somehow "cleaner" than build scripts. "Putting aside deployment" means discouraging reproducibility and encouraging book burning.
Re:My VM is lighter and safer than your container by kenforthewin on Thursday November 02, 2017 @01:25PM (#15612357)
No, putting aside deployment means he was talking about the benefits of Docker for local development instead of the benefits of Docker for deployment. As to your talk of a build script, this is what the Dockerfile is for, and it is heavily documented.
Re:My VM is lighter and safer than your container by jjawssd on Thursday November 02, 2017 @02:07PM (#15612730)
Correct, but a Dockerfile is not the only way to create a docker image.
Re:My VM is lighter and safer than your container by unsignedinteger on Thursday November 02, 2017 @03:16PM (#15613387)
Packer has a docker-builder which constructs docker images without a dockerfile, found it useful for quickly converting between creating AMIs and Docker images for EC2.
Re:My VM is lighter and safer than your container by amcca029 on Thursday November 02, 2017 @01:20PM (#15612315)
can you describe this solid foundation in more detail?
Re:My VM is lighter and safer than your container by nur0n on Thursday November 02, 2017 @01:39PM (#15612463)
I think depends on the project, no? You first specify your dependencies, then provide a way to use the dependencies to build the end project.

If you don't have to specify the dependencies or the build process to the user, then you can get away with the build process not being well defined. Docker is a win for 'easy installation', but I wonder if it degrades the quality of projects which rely on it?

Re:My VM is lighter and safer than your container by berdario on Friday November 03, 2017 @05:18AM (#15617738)
> Gone are the days of building a VM from scratch, following instructions for a previous version of the OS, installing 10 dependencies, installing the app, cursing when it fails half way through, installing another missing dependency, installing the app again, bouncing the server, and then having it all fall apart again because the app isn't registered to run as a service at startup (because you missed that step).

Weird, You wouldn't have to deal with Nginx and services for local development

What you describe doesn't sound like local development... But rather acceptance/manual integration or product/feature review/approval

But in places with good automation there's tools or a pipeline that automatically spins up instances (potentially containers) with your branch/feature and automatically link them to other services and exposes them

From this point of view, docker can be useful for deployments... But it's mostly useless for development, since it doesn't help with keeping prod/Dev environments identical to each other

Re:My VM is lighter and safer than your container by koolba on Friday November 03, 2017 @07:49AM (#15618383)
> What you describe doesn't sound like local development... But rather acceptance/manual integration or product/feature review/approval

> ...

> But it's mostly useless for development, since it doesn't help with keeping prod/Dev environments identical to each other

If you're working on a feature that integrates with LDAP, you need an LDAP accessible locally. Docker lets you spin one up near instantly. The alternative I'm describing is to install the LDAP server locally or in a VM. Both are definitely options, but they're significantly more intrusive or involve (or both).

Ditto for a Postgres DB, a Redis server, or any other external resource needed by your app. It's not just for integration tests. You need them available to develop against and Docker provides a consistent way for everybody to spin up those resources quickly.

Re:My VM is lighter and safer than your container by chaostheory on Thursday November 02, 2017 @01:25PM (#15612350)
Yes, imo Docker makes it possible to migrate to Windows 10 from Mac OS and Linux
Re:My VM is lighter and safer than your container by SubuSS on Thursday November 02, 2017 @05:42PM (#15614544)
I have just barely fiddled with docker/kube - run into vagrant in one instance. I thought it was the reverse -https://www.quora.com/What-is-the-difference-between-Docker-...

Vagrant can mimic multiple OSs while containers are stuck to host os - What am I missing?

Re:My VM is lighter and safer than your container by mastax on Thursday November 02, 2017 @07:15PM (#15615247)
Docker for Windows/macOS run containers inside of a Linux VM, so nothing changes there. There's also Windows Server Containers which are what they sound like.
Re:My VM is lighter and safer than your container by jazoom on Thursday November 02, 2017 @05:07PM (#15614304)
Plus WSL. That makes so much pain go away.
Re:My VM is lighter and safer than your container by JonMR on Thursday November 02, 2017 @12:49PM (#15612051)
You're missing out in the meantime. Even just for a local development stack, it's extremely useful.
Re:My VM is lighter and safer than your container by geerlingguy on Thursday November 02, 2017 @09:13PM (#15615964)
Or CI. Having easy environments for any OS or software tool imaginable makes it quick and simple to test my applications across 10 OSes and OS versions as needed.
Re:My VM is lighter and safer than your container by api on Thursday November 02, 2017 @01:27PM (#15612367)
I thought I was the only one. A few years ago Devops conferences sounded like:

"Docker docker Docker? Docker. Docker docker docker docker Docker docker docker. Docker, Docker docker Docker docker Docker."

Now the hype seems to be wearing off and people are realizing that it's just a way of treating Linux installs like giant static binaries plus a whole lot of unnecessary complexity.

Re:My VM is lighter and safer than your container by dxhdr on Thursday November 02, 2017 @01:37PM (#15612433)
I'm glad I haven't spent any time on it.

"Docker is fantastic! You can run anything you want, easily. Except, uh, don't try to run a database or anything like that. Oh and here are a dozen different flow charts and tables explaining how to handle networking. And uh make sure you still do all of the same VM provisioning for security since containers don't give you any. Simple!"

Re:My VM is lighter and safer than your container by atoko on Thursday November 02, 2017 @02:11PM (#15612765)
Why can't you run a db server on a container?
Re:My VM is lighter and safer than your container by rm999 on Thursday November 02, 2017 @02:24PM (#15612904)
Containers are designed to be non-persistent - if an instance of a container goes down you should be able to replace it with another instance with no loss in state. Most people want their databases to be persistent (unless it's just temporary local storage for your process), so containers are a bad idea here. What you want is some sort of external storage to store state. This also enables better horizontal scaling.
Re:My VM is lighter and safer than your container by jcrites on Thursday November 02, 2017 @03:10PM (#15613346)
I would say this might be a description of Docker or Docker containers specifically, but does not characterize Linux containers generally.

Linux container technology, by which I mean the Linux kernel APIs used by Kubernetes, CoreOS rkt, and Docker, do not have an opinion about whether the processes that run as containers are ephemeral or persistent. Containers can be just as persistent as the host they're running on.

For example, consider a Linux distribution using systemd. Systemd might launch regular processes upon system startup, and it might also launch containers where both types of processes are equally persistent on the parent host. See the documentation for systemd-nspawn [1] and machinectl [2]. The Arch Linux wiki has more details about how to use that distribution with nspawn [3]. Containers managed in this way are just like other system processes aside from being containerized.

[1] https://www.freedesktop.org/software/systemd/man/systemd-nsp...

[2] https://www.freedesktop.org/software/systemd/man/machinectl....

[3] https://wiki.archlinux.org/index.php/Systemd-nspawn

Re:My VM is lighter and safer than your container by Ronsenshi on Thursday November 02, 2017 @03:48PM (#15613629)
Docker allows you to specify mounting directories on the host system. If you wish to have persistence of the data - it's simply the matter of specifying that mounting option.
Re:My VM is lighter and safer than your container by rm999 on Thursday November 02, 2017 @04:48PM (#15614170)
Sure, but that's not a database running in Docker, it's "external storage to store state". Which is the right way of doing things if you're ok with your data persisting on the server.
Re:My VM is lighter and safer than your container by orthecreedence on Thursday November 02, 2017 @02:37PM (#15613039)
I'm more curious, why would you run a DB in a container?

Containers seem really great for running inside schedulers in order to squeeze every last bit of performance out your servers while also making it easy to move things around as needed. To me this is things like app servers, web servers, load balancers, queue workers, microservices, etc.

I don't think of a database needing to be moved around, and I want its performance profile to have room for growth when needed (in other words, give me the beefiest server and only run the DB on it). Also, a database doesn't generally have 15 dependencies you have to hand compile/install like many apps do.

There seems to be a lot of operational complexity with doing things like "ok, here's our database, but the data is not in the container, and if the DB does move, we have to take the data with it." How long does the move take? Wouldn't it be better to just have another DB standing by to swap in immediately?

I guess my point is (and I'm actually, genuinely asking as someone who hasn't spent much time in the container world): what operational benefit does having a DB in a container give?

Re:My VM is lighter and safer than your container by mschuster91 on Thursday November 02, 2017 @06:57PM (#15615119)
> I'm more curious, why would you run a DB in a container?

I develop different PHP apps - some are, uh, fossilized and don't work with MySQL 5.7 or later, some are on a more modern stack and can work with the latest and greatest stuff. Other apps I am working on run on pgsql. Also, I am on OS X.

All of this means it's either a Vagrant VM which I always forget to shut down and breaks every couple of months instead of Docker where I can do a simple docker ps -aq|xargs docker stop, and everything is pretty much reproducible.

And no, running the DBs native on OS X is a pure PITA - good luck getting different versions of MySQL and PHP to peacefully coexist.

On production servers the story is different but I can tailor a production server environment to the exact specs the software requires.

Re:My VM is lighter and safer than your container by michaelmrose on Friday November 03, 2017 @12:23AM (#15616677)
If getting the software you need to actually run is painful enough that you just run linux in a vm with a wrapper how is that easier than running linux in a vm or just run linux natively?
Re:My VM is lighter and safer than your container by mschuster91 on Friday November 03, 2017 @05:41AM (#15617835)
It's not painful by itself - the problem is having to run wildly different environments all at once.
Re:My VM is lighter and safer than your container by xelxebar on Thursday November 02, 2017 @02:55PM (#15613218)
Hah. I know very little about containers beyond the unshare command and have been wondering how they avoid reintroducing all the problems of static binaries.

Makes me think of stali [0], the static linux distro that avoids all dynamic linking.

[0] https://sta.li/

Re:My VM is lighter and safer than your container by Terretta on Thursday November 02, 2017 @06:12PM (#15614777)
Joe Stein calls Docker images the “21st century tarball”.
Re:My VM is lighter and safer than your container by RubenSandwich on Thursday November 02, 2017 @12:25PM (#15611824)
I personally think Unikernals will overshadow Containers in a few years. They just in my mind offer a model that is much more security and speedy. I give them a few years because Unikernals still need to figure out better tooling; debugging, producing and deploying them is currently difficult.
Re:My VM is lighter and safer than your container by unilynx on Thursday November 02, 2017 @12:43PM (#15611998)
It seems pretty unlikely that unikernels will ever replace containers.

Containers allow you to run almost all of the past decades of software with no or little modification (and most modifications are done in bash), a unikernel is more like a new OS that applications need to be ported to, without the full POSIX API (eg, no subprocesses) - it's probably easier to port a multiprocess server (eg most SMTP servers) from Linux to the NT API than to port them to a unikernel

Re:My VM is lighter and safer than your container by pjmlp on Thursday November 02, 2017 @12:59PM (#15612142)
Not necessarily, on programming languages with nice standard libraries/runtimes it is just a matter of running them bare metal.

A JEE application doesn't care if WebSphere is running on OS XYZ, bare metal or an hypervisor.

In a way I consider POSIX C's runtime that should have been made part of ANSI C.

Re:My VM is lighter and safer than your container by tjbiddle on Thursday November 02, 2017 @12:39PM (#15611970)
A few years is a lifetime in tech; why not learn what is new and see how if it's applicable to you and improves things now? You'll come out with more experience, can throw it on your resume, and very likely be more prepared for the next tech to come along.
Re:My VM is lighter and safer than your container by pjmlp on Thursday November 02, 2017 @12:54PM (#15612088)
I think it would be quite cool, but it needs to become the next fashion in order to go mainstream.

After all we on Java world were already doing that with application containers, it would be just a matter of running them bare metal.

Re:My VM is lighter and safer than your container by apple4ever on Thursday November 02, 2017 @01:25PM (#15612352)
Ditto. Docker seems interesting, but also a solution without a problem.
Re:My VM is lighter and safer than your container by thenayr on Thursday November 02, 2017 @02:41PM (#15613083)
Keep ignoring it, at your own peril.