The command line
forge is Forge's command line. It starts runs and flows, follows their output, and manages
templates, environments, caches and runners.
Log in
Create an API key under your account (the user menu, API keys), then:
forge login --server https://forge.example.com
forge login reads the key from standard input, so it doesn't end up in your shell's history,
and keeps it for the next commands. forge whoami shows who you are logged in as. In scripts,
set FORGE_SERVER and FORGE_TOKEN instead.
Start a run
forge run alpine:3.20 echo "Hello from Forge"
forge run starts the run, prints its output as it comes, and exits with the run's exit code,
so it fits in scripts. With --detach it only starts the run and prints its id. Other ways to
start one:
forge run --template nightly-report --param day=monday
forge run --local # .forge/run.yaml with your own Docker
forge run --local runs the file with the Docker on your machine, without a server or a
runner, to try a change before you push it.
After it started
forge logs -f RUN # follow a run's output
forge wait RUN # wait until it ends; exits with its code
forge cancel RUN # cancel it
forge debug RUN # re-run it and open a shell once it fails
Run forge without arguments for every command, and forge COMMAND -h for a command's flags.