iximiuz / docker-to-linux

Make bootable Linux disk image (ab)using Docker
https://iximiuz.com/en/posts/from-docker-container-to-bootable-linux-disk-image/
659 stars 92 forks source link
bootloader docker linux linux-kernel virtual-machine

docker-to-linux - make bootable Linux disk image abusing Docker

! Support development of this project > patreon.com/iximiuz

There is no real goal behind this project. Just out of my curiosity what if:

Then it should be probably possible to launch a real virtual machine with such an image!

Try it out:

# 1. Build the image.
#    Depending on your setup, you may need to preceed `make` with `sudo`.
make debian  # or ubuntu, or alpine

# 2. Run it! Use username `root` and password `root` to log in.
qemu-system-x86_64 -drive file=debian.img,index=0,media=disk,format=raw -m 4096
# 2. Alternate
qemu-system-x86_64 -hda debian.qcow2 -m 512

# 3. Clean up when you are done.
make clean

It works!

You can increase or decrease the size of the VM hard disk via the environment variable VM_DISK_SIZE_MB (1024 by default).
For example for a 3GB disk:

make debian VM_DISK_SIZE_MB=3072  # or ubuntu, or alpine

Check out Makefile for more details or read my article on iximiuz.com.

Features

FAQ

Release notes

2021-05-24

2021-05-07

2021-05-02

2020-02-29

2019-08-02

2019-06-03

TODO

Similar projects

...or tangential projects relying on the similar technique: