Skip to content

codecrafters-io/oci-image-executor

Repository files navigation

oci-image-executor

Executes an OCI image using Firecracker.

Logs from the executed process (both stdout and stderr) are sent to stdout. Logs from the executor itself are sent to stderr.

Interface

oci-image-executor \
    --image-tar image.tar \
    --image-config image-firecracker-config.json \
    --volume /var/user-code-submission:/app
    --volume /tools/binary:/your-binary
    /usr/bin/binary-to-execute
  • --image-tar: Path to the image tar file, created using docker export
  • --image-config: Path to an OCI image config file
  • --volume: Copy a directory or file from the host into the VM (changes will not be synced back to the host)

Developing Locally

Many of the scripts in this repository aren't customized to work on macOS, so we use Vagrant to test this locally.

  1. Create your Vagrant VM:
vagrant up
  1. SSH into the VM and run tests using a sample image:
vagrant ssh
cd /var/opt/oci-image-executor
make create_test_image # in the vagrant shell

Testing Boot Time

To test the boot time of a barebones image, run the following:

  • git clone https://github.com/codecrafters-io/oci-image-executor.git
  • apt install moreutils
  • bash setup.sh
  • source ~/.bashrc (to pickup the GOPATH addition)
  • make create_test_image
  • make build
  • make test_boot_time