Skip to main content

Open a shell in a Cloider app and run commands

You can work inside a running app's container in two ways: the Terminal tab and cloider app shell open an interactive shell, like SSH, and cloider app exec runs one command and returns its output and exit code, which is what scripts, CI jobs and AI agents need. Typical uses are database migrations, one-off scripts, checking environment variables and debugging. This page covers both, with their limits. A cron job has nothing running between runs, so it has no Terminal tab: a running run has a Terminal button on the Runs tab, and cloider app shell and cloider app exec open a container with its image and environment that is started for them.

At a glance​

Terminal tab / cloider app shellcloider app exec / API / MCP
ForPeople, interactivelyScripts, CI, AI agents
Runsbash -l, or sh -l when the image has no bashOne command, directly or with sh -c
OutputA terminalSeparate stdout and stderr, and the exit code
InputYour keyboardOptional stdin, up to 2 MiB
Time limitUntil you exit; idle for 10 minutes ends the terminal10 minutes by default, up to 1 hour
NeedsA deployed, running app; read and write accessSame

Both run inside the app's current container, with its files and environment variables, as the container's user. Anything you change there (files, installed packages) is lost when the container restarts or a new version deploys, so make lasting changes in your source and deploy them.

Open a terminal​

  1. Open the app and go to the Terminal tab. It appears once a version has deployed, and is hidden while the app is paused.
  2. Wait for Connecting to the app.... The terminal starts on demand, which can take a few seconds the first time.
  3. You get a shell in the app's working directory. Type exit to end the session.
The Terminal tab of the blog app with a bash prompt inside the container after running ls
A shell inside the app's running container.

The prompt shows the app's name as the host name: Cloider sets the container's hostname to the app name.

When does the terminal stop?​

The terminal runs next to your app only while someone uses it. The dashboard's tab keeps it awake while it is open, and after 10 minutes with nobody using it, it goes to sleep until it is next opened. Closing the tab or leaving it ends your session. The terminal isn't part of your app's usage and isn't billed.

Run a command with exec​

cloider app exec runs one command in the app's container and exits with the command's exit code. Stdout and stderr stay separate and nothing is a terminal, so the output is exactly what the command printed.

The dashboard runs commands through the Terminal tab. For one-off commands from a script, use the CLI, the API or MCP.

Exit codes​

CodeMeaning
0The command succeeded
Any otherThe command's own exit code
124--timeout stopped the command
126The command exists but can't run (permissions)
127The command doesn't exist in the image

The CLI's own error codes (1 to 5) can also be a command's. With -o json, the JSON is only printed when the command ran, which tells the two apart. Like kubectl exec, a command that prints nothing can keep running in the container after a timeout or Ctrl-C.

Common tasks​

# Run database migrations
cloider app exec api python manage.py migrate
cloider app exec --timeout 30m web -- npx prisma migrate deploy
cloider app exec shop -- php artisan migrate --force
cloider app exec store -- bundle exec rails db:migrate

# Check what the app sees
cloider app exec blog printenv
cloider app exec blog -- cat /etc/os-release

# Test a dependency from inside the app
cloider app exec blog "wget -qO- http://localhost:\$PORT/health"

Troubleshooting​

MessageCause and fix
This app has not been deployed yet!There is no container until the first build succeeds. Check the Builds tab
This app is paused. Resume it to open a terminal! / ...to run a command!Resume the app, see Pause, resume and delete
Your app isn't running right now, so there is nothing to open a terminal in. Check the Logs tab, then reconnect.The container is restarting or crashing. Check the logs
This app's image has no shell (e.g. a distroless image), so a terminal can't be opened in it. Use the Logs tab instead.Distroless and scratch images have no sh. Use cloider app exec with a full argument list, or add a shell to the image
Terminals need a Read & Write API token!The CLI's token is read-only. Log in again with Read & Write access
You have read-only access to this account, you can not run commands!Your role in the account is read-only
The terminal could not be started, try again in a moment!The terminal didn't wake in time. Try again
This app has no running container right now!The app is between containers (a restart or a rollout). Try again in a few seconds
127 exit codeThe command isn't installed in the image. Buildpack images don't include every tool, so check with cloider app exec <app> "command -v <tool>"

Next steps​

Frequently asked questions

Can I SSH into a Cloider app?

There is no SSH, but the Terminal tab in the dashboard and cloider app shell <app> open an interactive shell inside the app's running container, which is what SSH would give you.

How do I run database migrations on a Cloider app?

Run them inside the app's container with cloider app exec, for example cloider app exec api python manage.py migrate. The command exits with the migration's exit code, so it works in CI too.

Do changes made in the terminal persist?

No. Files written and packages installed inside the container are lost when it restarts or a new version deploys. Make lasting changes in your source code and deploy them.

How long can a command run with cloider app exec?

10 minutes by default. Set --timeout up to 1h. When the timeout stops a command, cloider exits with code 124.

Why can't I open a terminal in my app?

The app must be deployed and running, not paused, and its image must contain sh. You also need read and write access: read-only members and read-only API tokens can't open terminals or run commands.