API Reference

lean build


Build Docker images of your own version of LEAN.

$ lean build [OPTIONS] [ROOT]


Builds local Docker images of a local version of LEAN and sets them up for local usage with the CLI. After running this command, all commands that run the LEAN engine or the research environment use your custom images. This command performs the following actions:

  1. The lean-cli/foundation:latest image is built from Lean / DockerfileLeanFoundation (if you're using an AMD64-based system) or Lean / DockerfileLeanFoundationARM (if you're using an ARM64-based system).
  2. LEAN is compiled in a Docker container using the lean-cli/foundation:latest image.
  3. The lean-cli/engine:latest image is built from Lean / Dockerfile using lean-cli/foundation:latest as the base image.
  4. The lean-cli/research:latest image is built from Lean / DockerfileJupyter using lean-cli/engine:latest as the base image.
  5. The default engine image is set to lean-cli/engine:latest.
  6. The default research image is set to lean-cli/research:latest.

When the foundation Dockerfile is the same as the one used for the official foundation image, step 1 is skipped and quantconnect/lean:foundation is used instead of lean-cli/foundation:latest.


The lean build command expects the following arguments:

<lean>The path to the directory containing the LEAN repository. Defaults to the current working directory.


The lean build command supports the following options:

--tag <string>The tag to apply to custom images (defaults to latest)
--verboseEnable debug logging
--helpDisplay the help text of the lean build command and exit

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: