Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push Docker containers managed by Docker-compose to Heroku?

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?

like image 658
AspiringMat Avatar asked Oct 24 '17 06:10

AspiringMat


People also ask

Can you deploy with Docker compose Heroku?

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.

How do I push a Docker image to Heroku?

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 ...

How do I host a Docker container in Heroku?

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.


1 Answers

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.

like image 100
AspiringMat Avatar answered Oct 03 '22 18:10

AspiringMat