docker-routeros icon indicating copy to clipboard operation
docker-routeros copied to clipboard

This vs. VM

Open mhkarimi1383 opened this issue 3 years ago • 8 comments

I want to see this image is more efficient or Virtual machine Because you are using qemu inside alphine

mhkarimi1383 avatar Jun 18 '21 05:06 mhkarimi1383

Hello! Unfortunately it is not simple extract RouterOS and pack to Docker image directly (without virtual machine level), I've tried many different ways, and qemu based solution was the most optimal for achieving the goal. But a lot of time has passed since then, perhaps more convenient tools have appeared for solving such problems. Maybe you can suggest more optimal solution?

EvilFreelancer avatar Jun 18 '21 06:06 EvilFreelancer

I think If you have microtik you can just get it's rootfs (like other OSes) and put it in a tarball and using ADD in docker you can extract it into / and just use CMD ["/bin/sh"] like here for alphine https://github.com/alpinelinux/docker-alpine/tree/v3.13/x86_64

mhkarimi1383 avatar Jun 18 '21 08:06 mhkarimi1383

Yes, it is possible, but problem is that it won't work and when you try to run such a Docker image, you will get a kernel panic of your host machine. By the way, you don't need to have a router at hand, just unpack the operating system from archive image or VM image.

EvilFreelancer avatar Jun 18 '21 08:06 EvilFreelancer

let me try it out :)

mhkarimi1383 avatar Jun 18 '21 10:06 mhkarimi1383

I did it but I got this error

ERROR: opening root device = Operation not permitted
ERROR: opening root device = Operation not permitted
ERROR: opening root device = Operation not permitted
ERROR: opening root device = Operation not permitted
ERROR: opening root device = Operation not permitted
ERROR: opening root device = Operation not permitted
ERROR: opening boot device = Operation not permitted
ioctl FIBMAP failed
ioctl FIBMAP failed
ioctl FIBMAP failed
ioctl FIBMAP failed
ioctl FIBMAP failed
ioctl FIBMAP failed

Here is my Dockerfile

FROM scratch
ADD . /
CMD ["/bin/milo"]

mhkarimi1383 avatar Jun 18 '21 11:06 mhkarimi1383

Yep, because RouterOS is not just a shell, it also a custom linux kernel with tons of patches related to Miktorik devices.

EvilFreelancer avatar Jun 18 '21 11:06 EvilFreelancer

This is why i've choose the qemu based solution.

EvilFreelancer avatar Jun 18 '21 11:06 EvilFreelancer

It will be better if we know what to run to make it working

mhkarimi1383 avatar Jun 18 '21 12:06 mhkarimi1383