modal shell

Run an interactive shell inside a Modal image.


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

modal shell

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

Start a python shell:

modal shell --cmd=python


modal shell [OPTIONS] FUNC_REF


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


  • --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.