Tutorial¶
Learn contree-cli by building a real workflow — from zero to automated scripting in six short sections.
What you’ll build¶
By the end of this tutorial you will:
Spin up sandboxes from images and run arbitrary commands
Track sandbox state through sessions with branching and rollback
Inject local files, edit remote configs, and tag working images
Script everything with JSON output, detached runs, and operation monitoring
Before you start¶
You need two things:
Python 3.10+ installed on your machine
A ConTree API token — get one from your project dashboard
The path¶
Install contree-cli, save your API token, and set up named profiles for different environments.
Browse images, run commands, inspect the filesystem, and download files. Understand how each run creates a new checkpoint.
Use the REPL for rapid iteration: tab completion for paths, images, and branches, command aliases, and persistent history.
Branch off to experiment, roll back mistakes, share sessions across terminals, and start fresh when needed.
Inject local code into sandboxes, edit remote files in-place, and stage changes that auto-attach on the next run.
Tag working images for reuse, import from registries, and search by prefix. Build reusable base environments.
Shell mode, shebang scripts, detached runs, operation monitoring, and machine-readable output formats for pipelines.
Create and switch between profiles for different projects, understand how profiles affect sessions, and configure environment variables.
Quick taste¶
If you just want to see contree-cli in action before diving in:
# install
git clone https://github.com/nebius/contree-cli.git
cd contree-cli && uv sync
# authenticate (token prompted securely)
contree auth
# start a session and run a command
eval $(contree use tag:ubuntu:latest)
contree run uname -a
# inspect the result
contree ls /
contree cat /etc/os-release
# install and authenticate first (see CLI tab)
contree auth
# start the interactive shell
contree shell
Once inside the shell:
contree use tag:ubuntu:latest
uname -a
ls /
cat /etc/os-release
Ready? Start with Install & Authenticate.