karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steinar Bang ...@dod.no>
Subject Creating docker image from docker hub karaf image (Was: Is it possible to make karaf run a set of command line commands?)
Date Sun, 12 Apr 2020 13:24:56 GMT
>>>>> Jean-Baptiste Onofré <jb@nanthrax.net>:

> Hi,
> you can change in etc/shell.init.script.

> Here you can define a set of commands executed at startup. You can also create a
> script wrapping all your commands.

Tried this approach and I had some success.  The "success" is in that I
managed to end up with a working application-in-karaf in a docker
container.

The "some" is because I had to ssh in to the karaf-in-docker instance to
complete the application install.


 1. Copied etc/org.ops4j.pax.url.mvn.cfg from a karaf 4.2.8 instance,
    and added my own maven repo
     https://gist.github.com/steinarb/62a070f6481d3e84c334a78f1c771e80#file-org-ops4j-pax-url-mvn-cfg-L113

 2. Copied shell.init.script and added the feature:repository-add and
    feature:install commands at the end
     https://gist.github.com/steinarb/f6b5b1b76a4943fe43f1ff387f38332e#file-shell-init-script-L67

 3. Created a Dockerfile adding to the official docker hub karaf 4.2.8
    image, copying in the two modified config files
     https://gist.github.com/steinarb/3e0197f2805439861d6df0b05f1419d7

 4. Built the image from the Dockerfile
     docker build -t steinarb/ukelonn-demo:v1 .

 5. Started the image
     docker run -p 8101:8101 -p 8181:8181 -d steinarb/ukelonn-demo:v1

 6. Nothing was listening on port 8181

 7. Started logging in follow mode (used "docker ps" to find the
    container id)
     docker logs -f ffc851f87207

 8. SSH'd in to karaf running inside the docker container
     ssh -p 8101 karaf@localhost

 9. The log in follow mode showed the feature being installed

10. Now I could connect to http://localhost:8181/ukelonn where I found
    the demo version of my application running


Mime
View raw message