e2b-dev / e2b-dev/runtime

Feature: export template/sandbox rootfs as Docker image

Open
#3,272 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.6k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Summary

Add a way to export an e2b template (or paused sandbox) rootfs as an OCI/Docker
image, so the environment can be used as a base for new Docker builds or migrated
to other container runtimes without requiring e2b infrastructure.

Motivation

Currently the only supported direction is:

  Docker image → e2b template (via `oci.go` pull + ext4 conversion)

There is no supported path back. Users who have iterated on a sandbox
environment (installed packages, configured services, trained models, etc.)
cannot extract that state as a portable Docker image without manually mounting
the raw ext4 file, which requires root access to the orchestrator host.

Proposed API

A new CLI command (or API endpoint):

  e2b template export <templateId> --output my-image:latest
  # or
  e2b template export <templateId> --tar ./rootfs.tar

What it should do

  1. Retrieve the template's rootfs.ext4 from storage.
  2. Mount it and pack the filesystem into an OCI image (using
    go-containerregistry — already a transitive dependency via the build path).
  3. Optionally strip e2b-specific services (envd, init scripts) so the result
    is a clean base image.
  4. Push to a registry or write a local .tar that docker load can consume.

What it cannot do

The memory snapshot (memfile) has no Docker equivalent — exported images
capture disk state only, not in-flight process memory.

Related

  • core/oci/oci.go already pulls and unpacks OCI images into ext4 — the
    inverse operation reuses the same go-containerregistry primitives.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading core/oci/oci.go and tracing the existing OCI pull and ext4 conversion path, then review how template rootfs.ext4 is retrieved. Define whether the first implementation targets the CLI, an API endpoint, or both, and confirm the go-containerregistry capabilities. Done means disk state can be exported as a registry image or docker-load-compatible tar, with memory state explicitly excluded.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.