Issue
After converting to Docker images, I have extra dynos that I'm unable to scale down or stop.
For example:
- I previously built a slug-based app with the process types
web
andworker
. - I switched to Docker images, and now use containers named
web
andbackground_jobs
. - I now have a
worker
dyno that remains on my app, but attempts to stop or scale it fail with a "Couldn't find that process type" error
Resolution
When pushing and switching to Docker images, dyno management changes in ways that are incompatible with standard Heroku-built slugs. If your released container process type names differ from the names of your process types previously specified in your Procfile
, your previous process types may continue to attempt to start and crash repeatedly, continuing to accrue billing charges.
In order to resolve this, you need to make Docker "aware" of the previous process type(s) in order to be able to scale them down.
Using the previous process types as an example, you want to run web
and background_jobs
, so the worker
group needs to be scaled down. To resolve this situation you should run:
heroku container:push worker
heroku container:release worker
heroku ps:scale worker=1
heroku ps:scale worker=0
All 4 steps are important, you must scale the group up, and then down in order to stop them.
Once completed, the dynos in these process types should no longer be attempting to start, nor show up in heroku ps
, and the its group will be listed as scaled to zero on the Heroku Dashboard.
If you no longer need the image for the process type you just pushed you can use the heroku container:rm
CLI command to delete that image. In this example, you would run heroku container:rm worker
.