This directory contains an example Flask 3.0 HTTP server.
To run this example, install Unikraft's companion command-line toolchain kraft
, clone this repository and cd
into this directory.
Use kraft
to run the image and start a Unikraft instance:
kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 512M .
If the --plat
argument is left out, it defaults to qemu
.
If the --arch
argument is left out, it defaults to your system's CPU architecture.
Once executed, it will open port 8080
and wait for connections.
To test it, you can use curl
:
curl localhost:8080
You should see a "Bye, World!" message.
To list information about the Unikraft instance, use:
kraft ps
NAME KERNEL ARGS CREATED STATUS MEM PORTS PLAT
strange_harambe oci://unikraft.org/python:3.10 /app/server.py 11 seconds ago running 488M 0.0.0.0:8080->8080/tcp qemu/x86_64
The instance name is strange_harambe
.
To close the Unikraft instance, close the kraft
process (e.g., via Ctrl+c
) or run:
kraft rm strange_harambe
Note that depending on how you modify this example your instance may need more memory to run.
To do so, use the kraft run
's -M
flag, for example:
kraft run --rm -p 8080:8080 --plat qemu --arch x86_64 -M 1024M .
Mixing invocations of kraft
and sudo
can lead to unexpected behavior.
Read more about how to start kraft
without sudo
at https://unikraft.org/sudoless.