jose1711 / qemu_turrisos

Run TurrisOS inside QEMU
GNU Lesser General Public License v3.0
2 stars 1 forks source link

Add Dockerfile/Containerfile #6

Open emanuelb opened 4 years ago

emanuelb commented 4 years ago

I used below dockerfile for TOS 5.0.3 (was tested with docker on ubuntu & podman on fedora)

# build command:
# docker build --rm -t turrisos .
# run commands:
# docker run --cap-add=NET_ADMIN --device=/dev/net/tun --rm -ti turrisos
# docker run --privileged --rm -ti turrisos

FROM debian:sid-slim
RUN apt-get update && apt-get install --yes --no-install-recommends bash wget iproute2 procps iptables file qemu-system-arm git ipxe-qemu ca-certificates

RUN set -ex; \
    git clone --depth 1 https://github.com/jose1711/qemu_turrisos && cd qemu_turrisos ;\
    wget --output-document=zImage https://downloads.openwrt.org/snapshots/targets/armvirt/32/openwrt-armvirt-32-zImage ;\
    mkdir root && cd root ;\
    wget --output-document=- https://repo.turris.cz/hbs/medkit/omnia-medkit-latest.tar.gz | tar xvzf - ;\
    sed -i 's/python3.6/python3.7/' ../provision_rootfs.sh

WORKDIR /qemu_turrisos/
ENTRYPOINT ["/qemu_turrisos/start_omnia.sh"]

command sed -i 's/python3.6/python3.7/' ../provision_rootfs.sh used as fix for #1

which can be run like:

docker run --cap-add=NET_ADMIN --device=/dev/net/tun --rm -ti turrisos

(it shows error sysctl: permission denied on key "net.ipv4.ip_forward" which I didn't found a way to fix without using below --privileged option, but it's does show the TOS console)

or:

docker run --privileged --rm -ti turrisos

After fixing issue #5 it can be something like: (COPY instructions to copy files from current directory (user already did git-clone or downloaded master.zip))

FROM debian:sid-slim
COPY . . 
RUN setup.sh
WORKDIR /qemu_turrisos/
ENTRYPOINT ["/qemu_turrisos/start_omnia.sh"]
jose1711 commented 4 years ago

Planning a PR?

emanuelb commented 4 years ago

Planning a PR?

No/Not yet, as the Dockerfile/Containerfile should work for other use-cases/images as well, thus require fixing #5 first, and better to fix #1 as well.