Getting error while deploying keycloak docker image to Heroku - docker

I am pretty new to Heroku.
I am trying to deploy a keycloak docker image to heroku. I am getting this error while building the keycloak docker image.
! No default language could be detected for this app.
HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
See https://devcenter.heroku.com/articles/buildpacks
! Push failed
Any idea why is this happening ?
What is the build pack i need to select ?
My docker file looks like this
COPY docker-entrypoint.sh /opt/jboss/tools
ENTRYPOINT [ "/opt/jboss/tools/docker-entrypoint.sh" ]
CMD ["-b", "0.0.0.0"]```

Please see this: Github keycloak-heroku.
You can deploy using the deploy button from heroku or you can build and push your own image from the latest keycloak version. In my experience, you should use a dyno with at least 1 Gb ram for keycloak 11.

Related

Pushing Changes to Existing Heroku Registry

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.

Failure to push Docker Image to Heroku Repository due to 'unauthorized access' error

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

Link to Heroku Registry to pull the latest Docker image and use it as base image to prevent the release process from rebuilding it from the scratch

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?

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

can't build the docker image with error saying image not found

I am trying to build a docker image from public repository. Actually I had built it successfully before, today I wanted to update the image to latest one, so I removed the older image, and tried to pull the new image.
However, when I tried
$ docker pull dockerfile/ghost
Pulling repository dockerfile/ghost
FATA[0001] Error: image dockerfile/ghost:latest not found
I can't really understand why it doesn't work, it is supposed to be working.
This is what you need
Use docker pull ghost.
Thanks, #Chandan. I followed his advice to find the problem through
docker logs container_id
Firstly, the error is
ERROR: casper cannot be activated because it is not currently
installed.
so I downloaded the casper and put it into the theme folder.
Secondly, the error is
Migrations: Up to date at version 003 Ghost is running in
development... Listening on 127.0.0.1:2368 Url configured as:
http://localhost:2368
because the ghost server is running in the development mode.so I make it as production mode.
Thirdly, by making it into the production mode, there is a error
ERROR: Unable to access Ghost's content path:
so I followed the instruction to edit /path/to/ghost/blog/config.js and copy the paths section from development to production. Then restart the container.
docker restart some-ghost
at last it works
Replace
docker pull dockerfile/ubuntu
with
docker pull ubuntu
Similarly in Dockerfile for base image pull, replace
FROM dockerfile/ubuntu
with
FROM ubuntu
Change ubuntu to any other image name you require

Resources