Skip to content

lczyk/runbf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runbf

Containerd v2 runtime shim for brainfuck.

This works analogously to WASI runtimes. The container consists of a single entrypoint:

FROM scratch
COPY bf/programs/factors.bf /
CMD ["/factors.bf"]

which can then (after installing the shim, see below) be run with:

docker run --rm --runtime brainfuck --network none -t bf:latest

instructions

I've developed this on macos so step 1) was to hack into the vm in which 'Docker Desktop' runs its containers. TLDR; this is done with the ./scripts/macos_docker_desktop_hyperv_login.sh script.

In general the shim ought to work on any platform though. Just follow the installation instructions for containerd shims for your os / adapt the instructions below.

1) Build shim (my vm is Linux docker-desktop 6.10.14-linuxkit aarch64 GNU/Linux)

GOOS=linux GOARCH=arm64 go build ./cmd/containerd-shim-brainfuck-v1.go

2) Place it somewhere containerd can find it (here is where i need to hack into the vm):

./scripts/macos_docker_desktop_hyperv_login.sh -nkvf ./containerd-shim-brainfuck-v1:/usr/bin/containerd-shim-brainfuck-v1

NOTE: If, like me, you're adding the runtime to a volative vm, you will need to redo this if tou restart docker-desktop.

3) Add the runtime to docker daemon config (you will need to restart it afterwards)

jq ".runtimes += {\"brainfuck\": {\"runtimeType\": \"/usr/bin/containerd-shim-brainfuck-v1\"}}" ~/.docker/daemon.json >/tmp/daemon.json
cat /tmp/daemon.json >~/.docker/daemon.json

4) Build dockerfile and run:

docker build --file=Dockerfile -t bf .
docker run --rm -it --runtime brainfuck --network none -t bf:latest

dev

You can read the containerd logs with:

tail -f ~/Library/Containers/com.docker.docker/Data/log/vm/containerd.log

links

docker

bf

todos

  • make a graphics
  • connect stdin
  • try podman
  • try minikube
  • try colima

About

containerd shim and runtime for edge compute in brainfuck

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published