graft init
Initialize Graft on a target database container. This is the first command you run — it bridges the container’s Docker volume to the host filesystem and sets up the Graft project structure.
Usage
Behavior
- Inspects the target container (image, env, ports, network, volumes)
- Prompts you to select which Docker volume contains the database data
- Stops the container
- Copies data from the Docker volume to
~/.graft/<container>/branches/main/via an ephemeral Alpine runner - Sets up the
graft.dbSQLite DAG store andobjects/directory - If
--bind, recreates the container with a host bind mount - Starts the container
- Saves the state to
config.json
Flags
Examples
Interactive Init
With Explicit Volume
With Bind Mount
Output
Modes
In snapshot mode,
graft commit bridges from the Docker volume to the host. In bind mode, the container’s data lives directly on the host and no bridging is needed.