I managed the problem starting karaf in the background and installing features 
via client after startup. Therefore you need to wait until karaf starts and 
installed default packages.

You can see a sample here 
https://github.com/mhus/cherry-reactive/tree/master/reactive-docker/reactive-playground
 
<https://github.com/mhus/cherry-reactive/tree/master/reactive-docker/reactive-playground>

Important: if you plan to use local only bundles, you need to copy it into the 
project before you start docker build. You need a create.sh script to do the 
full image creation.

The script is not finished at all but it’s working.
 
Mike.

> On 17. Mar 2018, at 23:18, Michal Hlavac <m...@hlavki.eu> wrote:
> 
> you can use docker exec or compose exec to run multiple commands from file.
> create configure.cmd file with commands e.g.
>  
> config:edit com.example.config
> config:property-set example.property value
> config:update
> then run:
>  
> docker-compose exec -T container /opt/karaf/bin/client -b < configure.cmd
>  
> m.
>  
> On štvrtok, 1. marca 2018 22:10:18 CET Steinar Bang wrote:
> > Is it possible to make a karaf installation run a set of console
> > commands?
> > 
> > What I would like to do, is to try to create a dockerfile setting up a
> > docker image for my webapp:
> >        https://github.com/steinarb/ukelonn
> > 
> > And the steps listed in 6. and 8. below are run from the karaf console.
> > Is it possible to run them from an outside script somehow?
> > 
> > What I would need to do to create a docker image, is to:
> >  1. Start with a minimal debian installation
> >  2. Add the default location of postgres databases as a volume
> >     (ie. mounted from the host's file system)
> >  3. Add /etc/karaf as a volume
> >  4. Add the repository for the unofficial karaf package
> >      echo "deb http://apt.bang.priv.no/public stable main" 
> > >>/etc/apt/sources.list
> >      wget -O - https://apt.bang.priv.no/apt_pub.gpg | apt-key add -
> >  5. Install karaf and postgresql and all of their dependencies
> >      apt-get update
> >      apt-get install -yq --no-install-recommends postgresql karaf
> >  6. Configure up an extra maven repository from the karaf console:
> >      config:edit org.ops4j.pax.url.mvn
> >      config:property-append org.ops4j.pax.url.mvn.repositories ", 
> > https://maven.bang.priv.no/repository/@id=ukelonn@snapshots, 
> > http://maven.vaadin.com/vaadin-addons@id=vaadin";
> >      config:property-set org.ops4j.pax.url.mvn.globalUpdatePolicy always
> >      config:update
> >  7. Create an empty database karaf owned by user karaf
> >      /usr/bin/sudo -u postgres createuser karaf
> >      /usr/bin/sudo -u postgres createdb -O karaf ukelonn
> >  8. Add the feature repository and install the features
> >      feature:repo-add 
> > mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
> >      feature:install ukelonn-db-postgresql
> >      feature:install ukelonn
> > 
> > 
> > 
> > 

Reply via email to