i am using heroku container:push web to deploy new image to heroku registry for my app. i tested my updated image on local docker, it working. But when re-deploy app with that command, it not working. Still old app state (with old code) exist, new image ignored.
So, heroku cache my app image? how can i delete cache?
Heroku changed the behavior of container:push a few days ago: https://devcenter.heroku.com/changelog-items/1426
Related
I am having the EXACT same issue as mentioned here: Can't release pushed docker image in heroku but no answers have seemed to worked.
Goal - I am trying to push a simple image or build from my docker on my laptop to heroku.
I already logged into heroku:
heroku login
I tried using the commands from here to push an existing image: https://devcenter.heroku.com/articles/container-registry-and-runtime#pushing-an-existing-image
>docker tag supportalloy/alloyautomate:latest registry.heroku.com/alloyautomate/app
>docker push registry.heroku.com/alloyautomate/app
Using default tag: latest
The push refers to repository [registry.heroku.com/alloyautomate/app]
e1abb02d73c6: Preparing
f0f8f865ab9e: Preparing
9c3ce5529e99: Preparing
bc918295c02b: Waiting
b1ac1eba9be8: Preparing
2638da3625d5: Pushed
7cc0623bd7a8: Pushed
f1859b30ca6b: Pushed
6a35d52a66fd: Pushed
fbd7d5451c69: Pushed
latest: digest: sha256:3e0ab858e3343XXXXXXXXXXX90c33f9ad5bfdc6a160bcaa7c2d97 size: 6622
So it seemed like as if the image was pushed to heroku but I don't see it anywhere in the dashboard. So I googled some more and apparently I am suppose to release the image after pushing but so far nothing has worked for releasing the image.
I tried:
heroku container:release web --app=alloyautomate
! Expected response to be successful, got 404
but got a 404 error
At this point I gave up and tried:
heroku container:release web -a app
! You do not have access to the app app.
which makes sense because I think you suppose to suppose to state the application name in heroku. However I am so lost as to what to do.
I have pushed a folder to heroku before using heroku cli, but I am trying to learn how to push a docker image.
I figured out my own issue again.
The answer is that I needed to set a git remote on the specific app in question.
heroku git:remote -a your_app_name
after doing this, I tried
heroku container:push web
then
heroku container:release and that worked
I created a web app and hosted it on Heroku a while ago. I basically wrote a dockerfile with all the instructions and followed steps like here. I just now opened my old laptop and made changes to some of the code. I tried to follow the same steps as usual to push changes, but when I run heroku container:push web -a bluebird-teaching (the app is called bluebird-teaching), I get a strange error.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I made sure that I'm logged in on Heroku CLI and my app still runs. The name of the app on Heroku is indeed the same name I'm putting in the tag (not sure of that matters). I can't just do heroku create because that's going to create a whole new app. I would just like to push changes to an existing app. Any ideas how I could do what I'm trying to do?
Thanks for any help.
Docker is not running on your old laptop.
The heroku container:push builds and pushes the image as defined in the Dockerfile: this needs the Docker deamon to run.
I am trying to push a Docker image to the Heroku repository (web process), but am getting an authorisation issue (in trying to connect to the Heroku repo). Am new to this area, so appreciate any guidance on how to resolve this matter. Below is a screen grab which shows the error at the bottom. To start, it shows that I have successfully built the Docker image and tagged it to heroku. The directory I am running this in, and where the Dockerfile etc is stored is 'quote-app'. Appreciate any help on this please -
Successfully built 74d28e1cf94a
Successfully tagged registry.heroku.com/quote-app/web:latest
jito76#jito76-VirtualBox:~/quote-app$ docker push registry.heroku.com/quote-app/web
The push refers to repository [registry.heroku.com/quote-app/web]
3dc73b143d23: Preparing
2c8df0ddcfaf: Preparing
c73fe40e801c: Preparing
6e9ea2b471fc: Preparing
485a88bfb7a0: Preparing
11b5066d94a5: Waiting
bd8e6688d36c: Waiting
07cab4339852: Waiting
unauthorized: authentication required
jito76#jito76-VirtualBox:~/quote-app$
Thanks for the suggestions peeps. I did login using the 'heroku container:login' command, and it stated that I had "logged in successfully" when I ran the command. I am running the docker commands from the Ubuntu directory, that the container/app is stored in, instead of running it from home or as 'root' user. Hence, Am wondering whether I have the right Linux user rights to execute the code from there. Otherwise, am out of ideas for now
I was doing trial and error and this sorted out the auth issue, not sure what exactly did the magic:
heroku login
heroku stack:set container -a
heroku container:push worker -a
heroku container:login
heroku container:push worker -a
Remember to enter your Heroku App name after -a.
The application name quote-app does not match the Heroku application name: this happens when creating the Heroku app from the command line (heroku create without additional parameters)
It is better to set the application name explicitly
$ heroku create quote-app
$ docker build -t registry.heroku.com/quote-app/web .
$ docker push registry.heroku.com/quote-app/web
$ heroku container:release web -a quote-app
I'm working to deploy a project to Heroku using the container registry, but right now, it seems that Heroku rebuilds from scratch which is a time-wasting.
So, after studying, I found these related posts:
https://stackoverflow.com/a/58204409/3944086
Can I use Heroku registry as a base image for review app service?
I created a Dockerfile.heroku with this code:
FROM registry.heroku.com/app_name/image_name:latest
and modified heroku.yml as follow:
build:
docker:
web: Dockerfile.heroku
But when I pushed it to Heroku I got this error from Heroku build log:
=== Fetching app code
=== Building release (Dockerfile.heroku)
Sending build context to Docker daemon 168.4kBStep 1/1 : FROM registry.heroku.com/app_name/web:latest
Get https://registry.heroku.com/v2/app_name/web/manifests/latest: no basic auth credentials
Locally, I've logged in Heroku registry and I can pull the image.
How can I fix this issue?
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?
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.
The more accurate heroku documentation for what you are looking to do is here:
https://devcenter.heroku.com/articles/container-registry-and-runtime
The above will walk you through setting up the heroku container plugin and logging into the registry. You can even migrate an image to a Dockerfile with the following line in your dockerfile:
FROM "<insert Dockerfile tag here>"
To easily set this up, you will name your Dockerfiles with different suffixes, such as Dockerfile.mongo, Dockerfile.node, Dockerfile.flask, and Dockerfile.javamvc. The suffix tells heroku the dyno name used for your web app. When you need to push all of your containers, you can do so with the following command, which will recursively build all dockerfiles as long as all of them have unique suffixes:
heroku container:push --recursive
As Heroku doesn't read docker-compose files, any environment variable setup/port exposure/etc will need to be migrated to the Dockerfile. Also as I can't find how to do persistent storage/volume mounting with containers on Heroku, I would recommend using a Heroku add-on for your mongo database.
On Heroku, you will see your app running as one dyno per Dockerfile, with each dyno's name as the suffix of each Dockerfile.
UPDATE:
Travis brings up a good point. Make sure to have a CMD statement in your Dockerfile, otherwise heroku will throw an error.
Heroku recently added a step to the process, you will need to run heroku container:release <your dyno name> for each dyno that you want to update.
Yet another update on this question, as I was looking into it and found out that Heroku now officially supports docker-compose.
Please follow this guide: Local Development with Docker Compose
Worth noting that, as Heroku is non-persistent, the guide above recommends you to use official docker images of (redis, postgres, etc.) for local development, but use Heroku's offerings when deploying on it.