Run One-Off Commands¶
One-off commands let you execute arbitrary commands inside your application's container without deploying. They run with the same code, environment variables, and dependencies as your application.
Running a Command¶
- Go to your application in the dashboard
- Navigate to Application Settings > Run Command
- Enter the command you want to execute
- Click Run
The command output is displayed in the dashboard as it runs.
Common Use Cases¶
Django Management Commands¶
Database Migrations¶
Debugging¶
python -c "import django; print(django.VERSION)"
node -e "console.log(process.env.DATABASE_URL)"
cat /etc/os-release
Data Tasks¶
How It Works¶
One-off commands run in a new container instance that is created from the same Docker image as your deployed application. The container:
- Has the same environment variables as your running processes
- Has the same code and installed dependencies
- Has access to the same volumes (if any are attached)
- Stops when the command completes
How the Command Text Is Read¶
On an application on a single server, the complete command runs inside the container, also when it contains shell characters such as &&, |, >, ;, $ or quotes:
- A plain command contains only words of letters, digits and the characters
_ @ % + = : , . / -, separated by spaces. For examplepython manage.py migrate. Appliku passes it to the container as its words. - Any other command runs in a shell in the container:
bashif the image has it, else/bin/sh. Thuspython manage.py migrate && python manage.py collectstatic --noinputruns both commands in the container, and inecho $DATABASE_URLthe variable gets its value from the container.
The same applies to cron jobs. Before November 2026, the shell of the server read these characters, so the part after && or | ran on the server.
Cluster Mode¶
In cluster mode, the leader node of your Docker Swarm cluster starts the command as a temporary Swarm service with one task. Swarm runs that task on one node of the cluster. When the cluster has worker nodes and the application does not allow placement on manager nodes, the task runs on a worker node.
Notes¶
- Long-running commands may time out. For recurring tasks, use cron jobs instead.
- One-off commands do not trigger a deployment or restart your running processes.
- The command runs with the image from your most recent successful deployment.