This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

Heroku CLI Cheatsheet

A comprehensive reference guide for Heroku CLI: application management, Docker containers, logging, addons, process dynos, domains, and config vars.

· Published

Heroku is a cloud Platform-as-a-Service supporting Ruby, Node.js, Python, Java, PHP, Go, and Docker containers.

Applications (heroku apps)

Creating Applications

heroku create sushi       # Creates app named 'sushi' and attaches git remote
heroku apps:info          # View details of current application
heroku apps:rename newname# Rename current app
heroku apps:destroy --app sushi # Delete an application

Docker Container Registry

heroku container:login
heroku container:push web
heroku container:release web

Collaboration & Ownership

heroku access                          # List collaborators
heroku access:add [email protected]     # Invite collaborator
heroku access:remove [email protected]  # Remove collaborator
heroku apps:transfer [email protected] # Transfer application ownership

Logs & Debugging

heroku logs                            # View recent log output
heroku logs --tail                     # Stream real-time logs
heroku logs --source app               # Filter application logs
heroku logs --source heroku --dyno router # Filter router logs

Configuration & Environment Variables

heroku config                          # List all config vars
heroku config:get DATABASE_URL         # Inspect specific variable
heroku config:set NODE_ENV=production KEY=value # Set environment variables
heroku config:unset KEY                # Remove an environment variable

Dynos & Process Management

heroku ps                              # List running dynos and status
heroku ps:scale web=2 worker=1         # Scale dynos
heroku ps:stop run.1234                # Terminate running dyno
heroku ps:restart                      # Restart all dynos
heroku run bash                        # Launch one-off interactive terminal
heroku run rake db:migrate             # Execute one-off command

Add-ons & Databases

heroku addons                          # List attached add-ons
heroku addons:create heroku-postgresql:essential-0 # Provision Postgres database
heroku pg:info                         # Check database health and connections
heroku pg:backups:capture              # Create manual database snapshot
heroku pg:backups:download             # Download database dump

Custom Domains

heroku domains                         # List configured domains
heroku domains:add www.example.com     # Add custom subdomain
heroku domains:add example.com         # Add apex domain
heroku domains:remove www.example.com  # Remove domain

References

Related topics