modal shell

Run an interactive shell inside a Modal image.

Examples:

Start a bash shell using the spec for my_function in your stub:

modal shell hello_world.py::my_function

Note that you can select the function interactively if you omit the function name.

Start a python shell:

modal shell hello_world.py --cmd=python

Usage:

modal shell [OPTIONS] FUNC_REF

Arguments:

  • FUNC_REF: Path to a Python file with a Stub or Modal function whose container to run. [required]

Options:

  • --cmd TEXT: Command to run inside the Modal image. [default: /bin/bash]
  • --env TEXT: Environment to interact with

If none is specified, Modal will use the default environment of your current profile (can also be specified via the environment variable MODAL_ENVIRONMENT). If neither is set, Modal will assume there is only one environment in the active workspace and use that one, or raise an error if there are multiple environments.

  • --help: Show this message and exit.