modal container
Manage and connect to running containers.
Usage:
modal container [OPTIONS] COMMAND [ARGS]...Options:
--help: Show this message and exit.
Commands:
exec: Execute a command in a container.list: List all containers that are currently running.logs: Fetch or stream logs for a specific container.stop: Terminate a running container.
modal container exec
Execute a command in a container.
Usage:
modal container exec [OPTIONS] CONTAINER_ID COMMAND...Options:
--pty / --no-pty: Run the command using a PTY.--help: Show this message and exit.
modal container list
List all containers that are currently running.
Usage:
modal container list [OPTIONS]Options:
--app-id TEXT: List containers running for a specific App.-e, --env TEXT: Environment to interact with. If unspecified, defers toMODAL_ENVIRONMENT, your active local profile, or your workspace default, in that order.--json--help: Show this message and exit.
modal container logs
Fetch or stream logs for a specific container.
By default, this command fetches the last 100 log entries and exits. Use -f to
live-stream logs from a running container instead. Fetch and follow are mutually exclusive.
Examples:
Get recent logs for a container:
modal container logs ta-123456Follow (stream) logs from a running container:
modal container logs ta-123456 -fFetch logs from the last 2 hours:
modal container logs ta-123456 --since 2hFetch logs in a specific time range:
modal container logs ta-123456 --since 2026-03-01T05:00:00 --until 2026-03-01T08:00:00Fetch the last 1000 entries:
modal container logs ta-123456 --tail 1000Fetch all container logs:
modal container logs ta-123456 --allUsage:
modal container logs [OPTIONS] CONTAINER_IDOptions:
-f, --follow: Stream log output until Container stops--all: Show all logs for the container--since TEXT: Start of time range. Accepts ISO 8601 datetime or relative time, e.g. ‘1d’ (1 day ago), ‘2h’, ‘30m’, etc.--until TEXT: End of time range; accepts same argument types as —since-n, --tail INTEGER: Show only the last N log entries--search TEXT: Filter by search text-s, --source TEXT: Filter by source: ‘stdout’, ‘stderr’, or ‘system’--timestamps: Prefix each line with its timestamp--help: Show this message and exit.
modal container stop
Terminate a running container.
This will send the container a SIGINT signal that Modal will handle. Any inputs that are currently running on the container will be cancelled and rescheduled on other containers.
Usage:
modal container stop [OPTIONS] CONTAINER_IDOptions:
-y, --yes: Run without pausing for confirmation.--help: Show this message and exit.