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
python manage.py createsuperuser
python manage.py collectstatic --noinput
python manage.py shell
Database Migrations
python manage.py migrate
rails db:migrate
npx prisma migrate deploy
Debugging
python -c "import django; print(django.VERSION)"
node -e "console.log(process.env.DATABASE_URL)"
cat /etc/os-release
Data Tasks
python manage.py loaddata fixtures/initial.json
python manage.py clear_cache
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)
- Is removed after the command completes
Cluster Mode
In cluster mode, one-off commands are executed from the leader node of your Docker Swarm cluster. The command runs in a container on that node, not distributed across the cluster.
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.