I am trying to execute untrusted user code as a sidecar container on Fly. My understanding is that Fly machines are running as Firecracker VMs, so while there is no KVM there should be a full Linux machine available. I would like to use podman to run containers, then change the runtime to gVisor for enhanced security (though I am indifferent on the podman vs docker/etc).
To do some initial testing, I’ve launched a ubuntu:24.04 image on Fly. I then got a shell on the machine with fly ssh console, and installed podman with apt-get -y install podman and gVisor with their instructions.
Podman works “normally”
root@185924c4565078:/# podman run -it alpine ash
/ #
But for my workload I need to restrict the amount of CPU time (and memory) each container can use. If I do that, it doesn’t work (with these two errors):
root@185924c4565078:/# podman run --cpus 0.01 -it alpine ash
Error: crun: open `/sys/fs/cgroup/cpu/libpod_parent/libpod-3aa0ac5688232d1c677c591a49dad08825867eb2833c666b02bdb30a40705598`: No such file or directory: OCI runtime attempted to invoke a command that was not found
root@185924c4565078:/# podman run --cpus 0.01 -it alpine ash
Error: container create failed (no logs from conmon): conmon bytes "": readObjectStart: expect { or n, but found , error found in #0 byte of ...||..., bigger context ...||...
Similarly if I just try to use gVisor’s runsc directly, it has a similar error:
root@185924c4565078:/# runsc do ls
creating container: cannot set up cgroup for root: configuring cgroup: stat /sys/fs/cgroup/cpu: no such file or directory
root@185924c4565078:/# runsc do ls
creating container: open /sys/fs/cgroup/cpu/runsc-385983/cgroup.procs: no such file or directory
I imagine that the post Docker without Docker, now with containers is related, and that the containers uploaded to Fly are not unpacked into a Firecracker VM (anymore?). And that is why it doesn’t have permission to do a privileged action like create a cgroup.
Also I am aware of Fly’s multi-container machines but I need to run user containers, so I do not think it is a good fit.
Does anyone have any ideas on how to run a container with gVisor within a Fly Machine?