modal shell

Run an interactive shell inside a Modal image.


Start a shell inside the default Debian-based image:

modal shell

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

modal shell

Start a python shell:

modal shell --cmd=python


modal shell [OPTIONS] FUNC_REF


  • FUNC_REF: Path to a Python file with an App or Modal function whose container to run.


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

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --image TEXT: Container image tag for inside the shell (if not using FUNC_REF).
  • --add-python TEXT: Add Python to the image (if not using FUNC_REF).
  • --cpu INTEGER: Number of CPUs to allocate to the shell (if not using FUNC_REF).
  • --memory INTEGER: Memory to allocate for the shell, in MiB (if not using FUNC_REF).
  • --gpu TEXT: GPUs to request for the shell, if any. Examples are any, a10g, a100:4 (if not using FUNC_REF).
  • --cloud TEXT: Cloud provider to run the shell on. Possible values are aws, gcp, oci, auto (if not using FUNC_REF).
  • --region TEXT: Region(s) to run the shell on. Can be a single region or a comma-separated list to choose from (if not using FUNC_REF).
  • --help: Show this message and exit.