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?
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 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.
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.
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.
You have to rename your file: from dockerfile
to Dockerfile
.
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