• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

iximiuz/docker-to-linux: Make bootable Linux disk image abusing Docker

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

iximiuz/docker-to-linux

开源软件地址(OpenSource Url):

https://github.com/iximiuz/docker-to-linux

开源编程语言(OpenSource Language):

Makefile 50.1%

开源软件介绍(OpenSource Introduction):

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

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

  • launch a base Linux container (debian, alpine, etc)
  • pull in Linux kernel & init system (systemd, OpenRC, etc)
  • dump container's filesystem to a disk image
  • install bootloader (syslinux) to this image...

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!

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

Features

  • Real quick build a bootable Linux image with a single command!
  • 3 target distributives: Ubuntu 20.04, Debian Bullseye, Alpine 3.13.5
  • Build from macOS (including M1 chips) or Linux hosts

FAQ

  • Q: I'm getting an error about "read-only filesystem". How can I make it writable?

    A: It's Linux default behaviour to mount the / filesystem as read-only. You can always remount it with mount -o remount,rw /.

  • Q: How can I access network from the VM / How can I SSH into the VM?

    A: Networking is not configured at the moment. If you want to configure it yourself, search for TUN/TAP/bridge devices. Don't forget to open a PR if you come up with a working solution.

Release notes

2021-05-24

  • Start using ext4 instead of ext3.

2021-05-07

  • Fix - Ubuntu 20.04 stopped working because of the changed path to vmlinuz and initrd files.

2021-05-02

  • Fix macOS support #10 (thanks to @xavigonzalvo for reporting and suggesting the fix)
    • move losetup call from Makefile to the builder container
    • explicitly select amd64 architecture in target distr Dockerfiles to support builds on ARM hosts (aka M1)
  • Upgrade target distr versions
    • Ubuntu 18.04 -> 20.04
    • Debian Stretch -> Bullseye
    • Alpine 3.9.4 -> 3.13.5

2020-02-29

  • Improve Alpine support #7 (creds @monperrus)

2019-08-02

  • Fix loopback device lookup #3 (creds @christau)

2019-06-03

  • Initial release

TODO

  • add basic networking support
  • make filesystem writable after boot
  • support different image formats (e.g. VirtualBox VDI)
  • support different target architectures (e.g. ARM)



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
run/linux0.11: Linux archaeology发布时间:2022-08-15
下一篇:
AimTuxOfficial/AimTux: A large Linux csgo cheat/hack发布时间:2022-08-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap