I currently have a locally tested and working web app that consists of 4 docker containers: Java MVC, NodeJS, Flask, and MongoDB. I have 4 Dockerfiles, one for each, and I manage the builds with docker-compose.yml.
However, now I want to push my code to Heroku and I read the documentation at https://devcenter.heroku.com/articles/container-registry-and-runtime. However, it seems very ambigious about how to use docker-compose on the production line. This is what it says on the docs:
"If you’ve created a multi-container application you can use Docker Compose to define your local development environment. Learn how to use Docker Compose for local development."
Can anyone guide me to some actual code of how I can push my project to the Heroku Container using Heroku's CLI?
Docker Compose is a tool for defining and running a multi-container Docker application. In this article you'll learn why Docker Compose is great for local development, how you can push your Docker images to Heroku for deployment, and Compose tips and tricks.
To deploy your Docker image to Heroku, simply run one command in the directory of your Dockerfile: $ heroku container:push web === Building web Step 1 : FROM alpine:latest ... Successfully built 74bab4bf0df3 === Pushing web The push refers to a repository [registry.heroku.com/yourapp/web] c8821d626157: Pushed ...
Heroku provides two ways for you to deploy your app with Docker: Container Registry allows you to deploy pre-built Docker images to Heroku. Build your Docker images with heroku. yml for deployment to Heroku.
Just an update on this question since it seems to be getting a lot of traction lately.
There is now an officially supported "Heroku.yml" solution offered by Heroku. You can now write a .yml file (with a format similar to docker-compose) and Heroku will work out your images. Just follow the link above for details.
Happy Heroku-ing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With