modal shell

Run an interactive shell inside a Modal image.

Examples:

Start a shell inside the default Debian-based image:

modal shell

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

modal shell hello_world.py::my_function

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.

Options:

  • --cmd TEXT: Command to run inside the Modal image. [default: /bin/bash]
  • --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 function on. Possible values are aws, gcp, oci, auto (if not using FUNC_REF).
  • --help: Show this message and exit.