My Experience Deploying a Node.js Docker Container to Heroku

Docker's website describes the container as
A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment. Containers isolate software from its surroundings, for example differences between development and staging environments and help reduce conflicts between teams running different software on the same infrastructure.
Containers are an alternative to traditional Virtual Machines and are plenty more portable and convenient. Docker is not the only container solution (or containerisation platform). For example there is Google's Kubernetes -

For my demo I decided to use platforms familiar to me and that I have access to. My starting point was this guide The below are the noteworthy things that I encountered.

I wanted to use Docker Community Edition but my laptop runs Windows 10 Home Edition which meant that I had to use Docker Toolbox instead and the CE told me this
HyperV is not available on Home editions. Please use Docker Toolbox.
I use powershell and I was able to start Docker with the command docker-machine start default. First problem I encountered was running the docker ps command
The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
At the end of starting the docker machine it does indicate Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command. After troubleshooting I found out that by running & "C:\Program Files\Docker Toolbox\docker-machine.exe" env | Invoke-Expression I would be setting the required environment variables. Alternatively I could use the Docker quick start terminal or Kitematic GUI.

Pay attention to the following warning. This is something for me to revisit
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
The next problem I had was that I could not load the app in the browser from localhost - ERR_CONNECTION_REFUSED. Found out I could access it from the container ip and if I wanted to use localhost I needed to map the ports in VirtualBox.

Next up was deploying to Heroku. My starting point was this article. I only needed the below 3 commands

heroku create
heroku container:push web --app your_app_name
heroku open --app your_app_name

The next error to deal with was from the Heroku logs
web process failed to bind to $PORT within 60 seconds of launch
Heroku assigns you a port and you have to use that so I had to modify my listen code as follows
app.listen(process.env.PORT || PORT, HOST);
One of the things I like to do is give my app a friendly name. After changing the app name I encountered the following error message because I forgot to pass the new app name in my commands
error parsing HTTP 400 response body: unexpected end of JSON input: ""
I noticed that the initial push takes a while but after then pushes with changes to server.js (for example) were much quicker with heroku reporting Layer already exists. Share your thoughts and experiences with me in the comments below.