Deploying an existing Docker image to Heroku

Pulling the image

The first step is to pull the image from the Docker registry (let’s call it my/image) and find its ID ( image_id ):

docker pull my/image
docker images | grep my/image | awk '{print $3}'

Pushing to Heroku

Providing you’re already logged into Heroku (via heroku login), you’ll then need to tag and push the image to your Heroku application (let’s call it my-heroku-app ):

docker tag image_id
docker push


Finally, to actually deploy the image:

heroku container:release web --app=my-heroku-app


It is possible to fully automate the process in a script. I published a Github gist to do just that as a proof of concept. Such script could obviously be improved (passing the Docker image and Heroku app as parameters, etc.), but it gets the job done:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store