I perosnally love Heroku for its effortless Docker deployments of simple apps that follow the twelve-factor philosophy. It just works. This website runs on Heroku too, yes. I love the fact that you do not have to add some complicated configuration to your application to make it work. You sometimes just want to spend no effort and have things working, especially if they are simple. You just take one environment variable given to you by Heroku- PORT - and use it. It’s even better if you use it with Gunicorn, since it understands the variable out of the box. Except for that, you just need to add one simple file - “heroku.yml” - to tell it what processes to run and it should work with your Dockerfile. Also using that file will build images on the Heroku server, so you don’t need to worry about anything else than “git push”.

        web: Dockerfile
    image: web
        - django-admin migrate

Example heroku.yml

I think that file is just simple and it does not have to be more complicated. We just point at our Dockerfile and tell it what commands to run on the image release. Awesome. More information about heroku.yml.

Use container stack

To create an app with container stack you can use the following command:

heroku apps:create  --stack container your-app-name

Provision add-ons

Or you can change the stack of your existing app:

heroku stack:set container

If you need a database, scheduler or cache store, you can just provision an add-on, example below.

heroku addons:add heroku-postgresql
heroku addons:add heroku-redis
heroku addons:add scheduler

Provision add-ons

It automatically sets you with DATABASE_URL and REDIS_URL. If you follow 12factor, your app probably understands those variables already. You can add any additional environment variables you need with the CLI, e.g. heroku config:set SECRET_KEY=test-secret-key. Easy. Automatic backups of your database? Sure - heroku pg:backups schedule --at "02:00 UTC".


If you just run a simple app that has not many visitors, like this website, you can run it for free. Free addons like PostgreSQL database, Redis or scheduler. The only caveat is that your dyno (Heroku process) will sleep after 30 minutes of inactivity, but you can just ping it from another server or use some sort of monitoring service that will do it for you. If you want to share an app with a team, you can’t do it on the free plan. But the cheapest plan starts at $7 a month and you don’t have to have you app on all the time if you want to save a bit of money.


This post is my honest opinion. It’s not sponsored and I have no connection with Heroku, etc.