Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy docker image (not Dockerfile) to Heroku?

Tags:

docker

heroku

I want to deploy an existing Docker image to Heroku, where there is no Dockerfile in the local directory. (I created the Docker foo:bar image using datasette, and I don't know where it puts the Docker image).

These are the Docker images I have available:

$ docker images
REPOSITORY                                     TAG        IMAGE ID            CREATED             SIZE
foo                                            bar        d41xxxc69862        About an hour ago   1.08GB
<none>                                         <none>     af079eb9ceda        About an hour ago   980MB

I want to deploy the first docker image (foo:bar) to Heroku.

I have tried doing heroku create my-app-12355, then:

heroku container:push web -a my-app-12355

But this gives me:

  ▸    No images to push

How do I specify the name of the image? I think the section on "Building and pushing images" in the documentation is what I need, but I don't understand what "app" and "process-type" should be.

UPDATE: I tried:

docker tag d41xxxc69862 registry.heroku.com/my-app-12355/web
docker push registry.heroku.com/my-app-12355/web

But when I do heroku container:push web -a my-app-12355 I still get No images to push. How do I tell it where the image is?

like image 636
Richard Avatar asked Jun 10 '18 22:06

Richard


People also ask

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

Can you deploy a Docker container to Heroku?

Heroku Container Registry allows you to deploy your Docker images to Heroku. Both Common Runtime and Private Spaces are supported. If you would like Heroku to build your Docker images, as well as take advantage of Review Apps, check out building Docker images with heroku. yml.


3 Answers

Useful Link: https://toedter.com/2016/11/05/deploying-spring-boot-apps-to-heroku-using-docker/

I think you need to first tag your image and then push it to heroku registry:

docker tag d41xxxc69862 registry.heroku.com/my-app-12355/web
docker push registry.heroku.com/my-app-12355/web

d41xx is image id. Or you can try {image name}/{tag} e.g. foo/bar

Possible process-types are web, worker and image.

After docker push you need to run docker release command as per this link

heroku container:release web --app=my-app-12355 -- you don't require the '/' before the app name. That worked for me.
like image 184
Mohsin Mehmood Avatar answered Jan 17 '23 18:01

Mohsin Mehmood


When pushing docker images to heroku, make sure your Dockerfile is named with an Uppercase "D". Heroku CLI does not seem to recognize dockerfile (with lowercase "D") as a viable name for searching the image file, although docker itself does. I fixed this issue with this solution. hope it helps.

like image 30
José Angel Rodríguez Ramos Avatar answered Jan 17 '23 20:01

José Angel Rodríguez Ramos


You have to rename your file: from dockerfile to Dockerfile.

like image 22
alessandroAmedei Avatar answered Jan 17 '23 18:01

alessandroAmedei