5 ms·
> Firecracker can start a VM in less than a second! So this makes it comparable to containers when speed in question. Anybody using this instead typical VM's
by majkinetor 6y ago
> Firecracker can start a VM in less than a second!
So this makes it comparable to containers when speed in question.
Anybody using this instead typical VM's in production (and not being Amazon) ?
- tptacek 6y agoYep. At Fly.io, we run customer containers on our own hardware around the world --- the normal workflow just pushes Docker containers to our registry --- by converting them into root filesystems and running them as Firecracker instances.
- alexchamberlain 6y agoWhat exactly is involved in converting them to root filesystems?
- iampims 6y agoI’d love to know more about this as well. That’s the part usually nobody talks about.
- e12e 6y agoHave a look at: https://stackoverflow.com/questions/23436613/how-can-i-convert-a-docker-image-into-a-vagrant-virtualbox-box#42845276 https://stackoverflow.com/questions/23436613/how-can-i-conve... Or "slim": https://news.ycombinator.com/item?id=20182141 https://news.ycombinator.com/item?id=20182141 Typically, a docker filesystem doesn't include a proper unit (docker will inject "tiny init") - so you would probably have to add a kernel, and init, somehow. I think I'd prefer to just create a vm, rather than re-use the pre-built docker.
- e12e 6y agoEd: a proper "init" not "unit"
- CodesInChaos 6y agoThe linked article contains a script building the file system. It creates a block device using `qemu-img`, adds an empty filesystem using `mkfs.ext4` and then simply mounts it and copies in the files. The previous posts cover this topic in more detail: Day 43: Building VM images - https://jvns.ca/blog/2021/01/21/day-43--building-vm-images/ https://jvns.ca/blog/2021/01/21/day-43--building-vm-images/ Day 44: Building my VMs with Docker - https://jvns.ca/blog/2021/01/22/day-44--got-some-vms-to-start-in-firecracker/ https://jvns.ca/blog/2021/01/22/day-44--got-some-vms-to-star...
- nicwolff 6y agoIt may not be what fly.io does but there's a walkthrough of the basic idea here https://iximiuz.com/en/posts/from-docker-container-to-bootable-linux-disk-image/ https://iximiuz.com/en/posts/from-docker-container-to-bootab...
- tptacek 6y agoIt's not a big secret or anything but it's changed recently and Jerome would do a better job of describing it than I would; apart from the filesystem stuff, we have an init we wrote in Rust that does a bunch of the lifting.
- jeromegn 6y agoWe use containerd with the devmapper snapshotter! Works nicely. We create a hard link to the resulting device for the root drive inside firecracker.
- freedomben 6y agoMay I ask why you use firecracker, especially when you already have Docker images in your registry? Do you need root and/or a kernel in your containers for your application?
- tptacek 6y agoBecause of multitenancy. It isn't safe to run jobs from different customers alongside each other in namespaced OS containers; instead, we give every customer instance its own VM and its own OS. This is the same model that Lambda and Fargate use (of course, that's what Amazon implemented Firecracker for). I linked to a blog post we wrote about the rationales here, upthread.
- freedomben 6y agoCool, thanks much. I'll find the link.