Skip to content

Latest commit

 

History

History
87 lines (61 loc) · 3 KB

File metadata and controls

87 lines (61 loc) · 3 KB

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