12

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?

Richard
  • 62,943
  • 126
  • 334
  • 542
  • Does this answer your question? [Heroku: How to release an existing image in gitlab CI/CD?](https://stackoverflow.com/questions/50909812/heroku-how-to-release-an-existing-image-in-gitlab-ci-cd) – Shane Stillwell Apr 23 '20 at 02:12

5 Answers5

23

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.
Enkum
  • 635
  • 8
  • 22
Mohsin Mehmood
  • 4,156
  • 2
  • 12
  • 18
  • Thanks! I did `docker tag d41xxxc69862 registry.heroku.com/my-app-12355/web` followed by `docker push registry.heroku.com/my-app-12355/web` and both ran OK. But when I do `heroku container:push web -a my-app-12355` I still see `No images to push`. – Richard Jun 11 '18 at 01:00
  • Also, not sure if you would expect anything to be at `https://registry.heroku.com/my-app-12355/web` or `https://registry.heroku.com/my-app-12355` (sorry, I'm very new to both Heroku and Docker and don't understand how they fit together...). But I see 404s at both addresses. – Richard Jun 11 '18 at 01:02
  • 2
    After `docker tag d41xxxc69862 registry.heroku.com/my-app-12355/web` and `docker push registry.heroku.com/my-app-12355/web` there is no need for container:push command. As per the article above the application should be accessible at `https://my-app-12355.herokuapp.com` – Mohsin Mehmood Jun 11 '18 at 05:34
  • The above commands was working last week. Seems that is no longer working. Someone can help us here? – Jhonatas Kleinkauff Jun 12 '18 at 02:04
  • Just to clarify i was using this guide as a ref https://blog.devcenter.co/deploy-asp-net-core-2-0-apps-on-heroku-eea8efd918b6 – Jhonatas Kleinkauff Jun 12 '18 at 02:06
  • [The Docker docs for push](https://docs.docker.com/engine/reference/commandline/push/#concurrent-uploads) suggest that I might need to do a `docker commit` before tag and push? – Richard Jun 15 '18 at 23:43
  • Hello @Richard, you have any news regarding this? – Jhonatas Kleinkauff Jun 20 '18 at 00:09
  • Hey, are you deploying a .net app? – Jhonatas Kleinkauff Jun 20 '18 at 16:47
  • @Richard I believe you need to run `heroku container:release web --app={app name} command` – Mohsin Mehmood Jun 24 '18 at 09:11
  • @Richard this answer worked for me, I believe it should be marked as the correct answer – Brian Ogden Jan 20 '19 at 21:51
  • I followed the steps. But I'm getting the error as `No command specified for process type web` when I tried `heroku container:release web --app={app name}` – Ashok KS May 17 '19 at 00:16
14

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.

5

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

prosoitos
  • 6,679
  • 5
  • 27
  • 41
3
heroku container:push image_name -a=app_name
Paul Roub
  • 36,322
  • 27
  • 84
  • 93
-1

The important part is to add the app name to the Dockerfile, so rename Dockerfile to be Dockerfile.web and respectively for any docker-compose services. Then you can simply push all at once with

heroku container:push --recursive --context-path .
  • 1
    please delete your answer, the question is about pushing an existing image where the Dockerfile does not exist. – estani Nov 07 '19 at 10:14