How do I define a start command for an app using Docker images?

Docker images do not use the Procfile to define process commands.

If the image is built locally and pushed to the Heroku Image Registry the start command should be defined in the Dockerfile as CMD.

To use the same image for multiple processes (eg web and worker) define a custom script as the startup command:

# Dockerfile

Then the script can inspect the $DYNO environment variable to use the correct command:

if [[ $DYNO == "web"* ]]; then
  rails server -p $PORT
elif  [[ $DYNO == "worker"* ]]; then
  sidekiq -q default

If the application is using heroku.yml (image is built on Heroku) the start command can be defined in the run section of heroku.yml*

*Apps in Private Spaces using heroku.yml must use the 1st, CMD approach. The run command from heroku.yml is not recognized in Spaces:

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support