Github Education
  • Github學生免費服務推薦
  • name.com免費網域申請
  • SendGrid - Email Service
  • Configcat - Global config setting
  • Transloadit - File conversion to cloud storage
  • i18n 管理平台 - lingohub
  • Push Notifications - PushBots
  • BrowserStack
  • Page
  • Ai
    • Stable diffusion
    • Changing Images Backgrounds
  • Copy of Crypto currency games
    • Gods Unchained
  • Digital Ocean
    • How to create cloud instance and access it on Digital Ocean
    • Deploy nodeJs on DigitalOcean droplet using docker
    • Deploy Redis to your local
  • Heroku
    • Heroku Cli
    • How to deploy Hello world to Heroku using docker
    • How to deploy NodeJS application to Heroku using docker
  • APIs
    • Google Geocoding API
    • FourSquare
    • Building APIs with Swagger
  • Util
    • Google Cloud Storage - Object storage
    • Google Search Console
    • Google Sign-in with Angular Front End
    • Google Sign-in with Nodejs Backend
    • Github Package
  • 推薦課程
  • Currently interested in
  • Useful info
  • Become a Front End Web Developer | Udacity
    • 2. CSS, Website Layout, Website Components
      • Lesson 2: CSS
      • Lesson 3: Flexbox
      • Lesson 4: CSS Grid
      • Lesson 5: Creating Responsive Layouts
      • How to use Adobe Design tokens - Spectrum
    • 3. Javascript & The DOM
      • Lesson 1: Syntax
      • Lesson 2: The Document Object Model
      • Lesson 3: Creating Content with JavaScript
      • Lesson 4: Working with Browser Events
  • Some tips
    • Github Blame View
  • Free
    • Openshift(WIP)
Powered by GitBook
On this page
  • Check if you have docker installed properly
  • Check if you can login as heroku user
  • Login to heroku docker
  • Create an app on heroku
  • Clone helloworld to your local
  • Connect you local git to remote heroku git
  • Build the image and push to Container Registry
  • Then release the image to your app
  • Now open the app in your browser
  • Logout heroku container

Was this helpful?

  1. Heroku

How to deploy Hello world to Heroku using docker

PreviousHeroku CliNextHow to deploy NodeJS application to Heroku using docker

Last updated 4 years ago

Was this helpful?

Here is the and steps in this article are my walk through.

Prerequisite: You need to have heroku CLI and docker CLI installed.

Check if you have docker installed properly

Enter docker ps in your terminal and you will see container info if you have installed docker.

>> docker ps

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

Check if you can login as heroku user

>> heroku login

heroku: Press any key to open up the browser to login or q to exit:
Opening browser to https://...
Logging in... done
Logged in as xxx@gmail.com

Login to heroku docker

>> heroku container:login

Login Succeeded

Create an app on heroku

>> heroku create <YOUR_APP_NAME>

Creating app... done, ⬢ <YOUR_APP_NAME>
https://<YOUR_APP_NAME>.herokuapp.com/ | https://git.heroku.com/<YOUR_APP_NAME>.git

You can double check on your heroku account

Clone helloworld to your local

>> git clone https://github.com/heroku/alpinehelloworld.git

Cloning into 'alpinehelloworld'...
remote: Enumerating objects: 59, done.
remote: Total 59 (delta 0), reused 0 (delta 0), pack-reused 59
Unpacking objects: 100% (59/59), done.

Connect you local git to remote heroku git

>> cd alpinehelloworld
>> heroku git:remote -a <YOUR_APP_NAME>

set git remote heroku to https://git.heroku.com/<YOUR_APP_NAME>.git

Build the image and push to Container Registry

>> heroku container:push web

=== Building web (/Users/xx/Documents/GitHub/heroku/alpinehelloworld/Dockerfile)
[+] Building 13.9s (12/12) FINISHED
 => [internal] load build definition from Dockerfile                                                                                  0.1s
 => => transferring dockerfile: 618B                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                     0.0s
 => => transferring context: 46B                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                      0.0s
 => [1/7] FROM docker.io/library/alpine:latest                                                                                        0.0s
 => => resolve docker.io/library/alpine:latest                                                                                        0.0s
 => [internal] load build context                                                                                                     0.0s
 => => transferring context: 791B                                                                                                     0.0s
 => [2/7] RUN apk add --no-cache --update python3 py3-pip bash                                                                        7.7s
 => [3/7] ADD ./webapp/requirements.txt /tmp/requirements.txt                                                                         0.0s
 => [4/7] RUN pip3 install --no-cache-dir -q -r /tmp/requirements.txt                                                                 4.7s
 => [5/7] ADD ./webapp /opt/webapp/                                                                                                   0.0s
 => [6/7] WORKDIR /opt/webapp                                                                                                         0.0s
 => [7/7] RUN adduser -D myuser                                                                                                       0.4s
 => exporting to image                                                                                                                0.7s
 => => exporting layers                                                                                                               0.7s
 => => writing image sha256:xx                                          0.0s
 => => naming to registry.heroku.com/<YOUR_APP_NAME>/web                                                                      0.0s
=== Pushing web (/Users/xx/Documents/GitHub/heroku/alpinehelloworld/Dockerfile)
Using default tag: latest
The push refers to repository [registry.heroku.com/<YOUR_APP_NAME>/web]
8226bf54123c: Pushed
5f70bf18a086: Pushed
1c2b1e95af23: Pushed
db9a34fb2c51: Pushed
18e8c98dbace: Pushed
d963f66aa644: Pushed
1119ff37d4a9: Pushed
latest: digest: sha256:xx size: 1779
Your image has been successfully pushed. You can now release it with the 'container:release' command.

Then release the image to your app

>> heroku container:release web

Releasing images web to <YOUR_APP_NAME>... done

Now open the app in your browser

>> heroku open

Logout heroku container

>> heroku container:logout

Removing login credentials for registry.heroku.com
heroku official doc