Heroku Container

1 min read heroku

Written in 2016. Tools, APIs and prices may have changed since.

Lab note What I wrote down while learning this by building with it. Short by design; the code is in pfeilbr/heroku-container-playground.

Learn heroku container support. Based on Heroku Container Registry and Runtime article


# install container support
heroku plugins:install heroku-container-registry

# login to registry
heroku container:login

# build
docker build -t my-nodejs-app .

# run
docker run -it --rm -p 8000:8000 --name my-running-app my-nodejs-app
# visit http://localhost:8000

# create heroku app
heroku create

# push.  NOTE: app name of "stormy-badlands-73151" will be different
heroku container:push web --app stormy-badlands-73151

# check that it is up and running
heroku ps --app stormy-badlands-73151

# visit in browser
heroku open --app stormy-badlands-73151

# update flow

# make change to `server.js`
# build and push
heroku container:push web --app stormy-badlands-73151

Keep learning

Get new guides and courses by email

An occasional email when I publish a new guide, course or post. No spam, and you can unsubscribe any time.

Sent with Buttondown. I never share your address. Prefer a feed? Use the RSS feed.