Skip to main content
An image is the set of files a sandbox starts with: the operating system, the languages and tools, and anything else installed in advance. If you have used Docker, it is the same idea, and the same images work. You choose a sandbox’s image with the image option when you create it. There are several kinds to choose from:
If you plan to run commands in the sandbox (rather than use it to serve an app), add "ready": "process". Without it, Fibre runs the image’s own startup command and waits for it to answer on its port. See sizes and installed tools for the details.

Build an image from a Dockerfile

A Dockerfile is a recipe for an image: start from this base, install these packages, copy in this code. Fibre can build an image from a Dockerfile for you. You do not need Docker on your machine, or a registry to store the result. You send the Dockerfile and the files it uses, Fibre builds the image, and the image is then ready to use in your account’s sandboxes. This example builds a small web API written with FastAPI, a popular Python framework, and then runs it in a sandbox that serves it at a public address.
1

Write the app and its Dockerfile

2

Send it to Fibre

Send the folder containing the Dockerfile as a single archive. (This folder is called the build context: the Dockerfile can only use files that are inside it.)
response
The build runs on Fibre while you wait or do something else. This one takes about 15 seconds. If you send exactly the same files and Dockerfile as an earlier build, Fibre does not build again. It answers straight away with "status": "succeeded", the earlier image, and "cached": true.
3

Follow the build

output
The build log streams one JSON line for each piece of build output, followed by an end line with the final status. It works just like a command’s output.
4

Run it

When the build has succeeded, its image field holds the name of the new image. Pass that name to a sandbox. This image runs a web server on port 8000, so the sandbox is reported as ready once the app answers, and the sandbox’s address then serves the API:
response
curl: start it and call it
output

Build options

You can adjust a build with these query parameters on POST /v1/builds: While it runs and after it ends, a build has one of these statuses:
Order the steps of your Dockerfile from the least to the most often changed: system packages first, then dependencies, then your own code. Fibre reuses every step that has not changed, so if you only change main.py, only the last step is rebuilt.
A build runs in a sandbox of its own and is billed like one while it runs. The build context can be up to 2 GB.

Image or snapshot?

Both images and snapshots give new sandboxes a head start, so it is worth knowing which to use. The difference is memory: an image keeps only files, while a snapshot also keeps running programs and everything in memory.

Errors

Clean up

Snapshots

Save a sandbox’s whole state and start new sandboxes from it, programs already running.

Private registries

Run images from your own registry.